def main():

    N = int(eval(input()))

    S = eval(input())

    ans = 0

    for n in range(N + 1):

        c = 0

        u = []

        for s in S[:n]:

            if s in u:

                continue

            if S[n:].count(s) > 0:

                c += 1

            u.append(s)

        ans = max(ans, c)

    print(ans)





main()

def main():

    N = int(eval(input()))

    S = eval(input())

    ans = 0

    for n in range(N + 1):

        c = 0

        for s in set(S[:n]):

            if S[n:].count(s) > 0:

                c += 1

        ans = max(ans, c)

    print(ans)





main()

def main():
    N = int(eval(input()))
    S = eval(input())
    ans = 0
    for n in range(N + 1):
        c = 0
        u = []
        for s in S[:n]:
            if s in u:
                continue
            if S[n:].count(s) > 0:
                c += 1
            u.append(s)
        ans = max(ans, c)
    print(ans)


main()

def main():
    N = int(eval(input()))
    S = eval(input())
    ans = 0
    for n in range(N + 1):
        c = 0
        for s in set(S[:n]):
            if S[n:].count(s) > 0:
                c += 1
        ans = max(ans, c)
    print(ans)


main()

-        u = [] -        for s in S[:n]: -            if s in u: -                continue +        for s in set(S[:n]): -            u.append(s)