def slove():

    import sys

    import collections

    input = sys.stdin.readline

    n = int(input().rstrip('\n'))

    s = str(input().rstrip('\n'))

    m_cnt = 0

    for i in range(1, n):

        t1 = s[:i]

        t2 = s[i:]

        t1 = collections.Counter(t1)

        t2 = collections.Counter(t2)

        cnt = 0

        for k, v in list(t1.items()):

            cnt += min(1, t2[k])

        m_cnt = max(m_cnt, cnt)

    print(m_cnt)





if __name__ == '__main__':

    slove()

def slove():

    import sys

    import collections

    input = sys.stdin.readline

    n = int(input().rstrip('\n'))

    s = str(input().rstrip('\n'))

    mc = 0

    for i in range(1, n):

        cnt = 0

        ts1 = list(dict(collections.Counter(s[:i]).most_common()).keys())

        ts2 = list(dict(collections.Counter(s[i:]).most_common()).keys())

        for k, in ts1:

            if k in ts2:

                cnt += 1

        mc = max(mc, cnt)

    print(mc)





if __name__ == '__main__':

    slove()

def slove():
    import sys
    import collections

    input = sys.stdin.readline
    n = int(input().rstrip("\n"))
    s = str(input().rstrip("\n"))
    m_cnt = 0
    for i in range(1, n):
        t1 = s[:i]
        t2 = s[i:]
        t1 = collections.Counter(t1)
        t2 = collections.Counter(t2)
        cnt = 0
        for k, v in list(t1.items()):
            cnt += min(1, t2[k])
        m_cnt = max(m_cnt, cnt)
    print(m_cnt)


if __name__ == "__main__":
    slove()

def slove():
    import sys
    import collections

    input = sys.stdin.readline
    n = int(input().rstrip("\n"))
    s = str(input().rstrip("\n"))
    mc = 0
    for i in range(1, n):
        cnt = 0
        ts1 = list(dict(collections.Counter(s[:i]).most_common()).keys())
        ts2 = list(dict(collections.Counter(s[i:]).most_common()).keys())
        for (k,) in ts1:
            if k in ts2:
                cnt += 1
        mc = max(mc, cnt)
    print(mc)


if __name__ == "__main__":
    slove()

-    m_cnt = 0 +    mc = 0 -        t1 = s[:i] -        t2 = s[i:] -        t1 = collections.Counter(t1) -        t2 = collections.Counter(t2) -        for k, v in list(t1.items()): -            cnt += min(1, t2[k]) -        m_cnt = max(m_cnt, cnt) -    print(m_cnt) +        ts1 = list(dict(collections.Counter(s[:i]).most_common()).keys()) +        ts2 = list(dict(collections.Counter(s[i:]).most_common()).keys()) +        for (k,) in ts1: +            if k in ts2: +                cnt += 1 +        mc = max(mc, cnt) +    print(mc)