# ABC098B - Cut and Count

import collections



n = int(eval(input()))

s = input().rstrip()

count = 0

answer = 0

lst = [i for i in s]



if collections.Counter(lst) == 1:

    print((1))

else:

    for i in range(1, n):

        count = 0

        lst_sub1 = lst[:i]

        lst_sub2 = lst[i:]



        set_sub1 = set(lst_sub1)

        set_sub2 = set(lst_sub2)



        for j in set_sub1:

            if j in set_sub2:

                count += 1

        answer = max(answer, count)



    print(answer)
# ABC098B - Cut and Count

def main():

    n = int(eval(input()))

    s = eval(input())

    cnt = 0

    for i in range(1, n):

        l, r = set(s[:i]), set(s[i:])

        cnt = max(cnt, len(l & r))

    print(cnt)





if __name__ == "__main__":

    main()
# ABC098B - Cut and Count
import collections

n = int(eval(input()))
s = input().rstrip()
count = 0
answer = 0
lst = [i for i in s]
if collections.Counter(lst) == 1:
    print((1))
else:
    for i in range(1, n):
        count = 0
        lst_sub1 = lst[:i]
        lst_sub2 = lst[i:]
        set_sub1 = set(lst_sub1)
        set_sub2 = set(lst_sub2)
        for j in set_sub1:
            if j in set_sub2:
                count += 1
        answer = max(answer, count)
    print(answer)

# ABC098B - Cut and Count
def main():
    n = int(eval(input()))
    s = eval(input())
    cnt = 0
    for i in range(1, n):
        l, r = set(s[:i]), set(s[i:])
        cnt = max(cnt, len(l & r))
    print(cnt)


if __name__ == "__main__":
    main()

-import collections +def main(): +    n = int(eval(input())) +    s = eval(input()) +    cnt = 0 +    for i in range(1, n): +        l, r = set(s[:i]), set(s[i:]) +        cnt = max(cnt, len(l & r)) +    print(cnt) -n = int(eval(input())) -s = input().rstrip() -count = 0 -answer = 0 -lst = [i for i in s] -if collections.Counter(lst) == 1: -    print((1)) -else: -    for i in range(1, n): -        count = 0 -        lst_sub1 = lst[:i] -        lst_sub2 = lst[i:] -        set_sub1 = set(lst_sub1) -        set_sub2 = set(lst_sub2) -        for j in set_sub1: -            if j in set_sub2: -                count += 1 -        answer = max(answer, count) -    print(answer) + +if __name__ == "__main__": +    main()