from sys import stdin





def main():

    N = int(stdin.readline().rstrip())

    S = stdin.readline()

    result = 0

    for i in range(1, N):

        s1 = S[:i]

        s2 = S[i:]

        result = max(result, len(set(s1) & set(s2)))

    print(result)





if __name__ == '__main__':

    main()

from sys import stdin





def main():

    N = int(stdin.readline().rstrip())

    S = stdin.readline().rstrip()

    print((max([len(set(S[:i]) & set(S[i:])) for i in range(1, N)])))





if __name__ == '__main__':

    main()

from sys import stdin


def main():
    N = int(stdin.readline().rstrip())
    S = stdin.readline()
    result = 0
    for i in range(1, N):
        s1 = S[:i]
        s2 = S[i:]
        result = max(result, len(set(s1) & set(s2)))
    print(result)


if __name__ == "__main__":
    main()

from sys import stdin


def main():
    N = int(stdin.readline().rstrip())
    S = stdin.readline().rstrip()
    print((max([len(set(S[:i]) & set(S[i:])) for i in range(1, N)])))


if __name__ == "__main__":
    main()

-    S = stdin.readline() -    result = 0 -    for i in range(1, N): -        s1 = S[:i] -        s2 = S[i:] -        result = max(result, len(set(s1) & set(s2))) -    print(result) +    S = stdin.readline().rstrip() +    print((max([len(set(S[:i]) & set(S[i:])) for i in range(1, N)])))