from collections import Counter



N = int(eval(input()))

s = eval(input())



res = 0

for i in range(1, N):

    c1 = Counter(s[:i])

    c2 = Counter(s[i:])

    res = max(res, len(set(c1.keys()) & set(c2.keys())))



print(res)

from string import ascii_lowercase



n = int(eval(input()))

s = eval(input())



ans = -1

for mid in range(1, n):

    # [0, mid), [mid, n)

    left = set(s[:mid])

    right = set(s[mid:])



    cnt = 0

    for c in ascii_lowercase:

        if c in left and c in right:

            cnt += 1

    ans = max(ans, cnt)

print(ans)

from collections import Counter

N = int(eval(input()))
s = eval(input())
res = 0
for i in range(1, N):
    c1 = Counter(s[:i])
    c2 = Counter(s[i:])
    res = max(res, len(set(c1.keys()) & set(c2.keys())))
print(res)

from string import ascii_lowercase

n = int(eval(input()))
s = eval(input())
ans = -1
for mid in range(1, n):
    # [0, mid), [mid, n)
    left = set(s[:mid])
    right = set(s[mid:])
    cnt = 0
    for c in ascii_lowercase:
        if c in left and c in right:
            cnt += 1
    ans = max(ans, cnt)
print(ans)

-from collections import Counter +from string import ascii_lowercase -N = int(eval(input())) +n = int(eval(input())) -res = 0 -for i in range(1, N): -    c1 = Counter(s[:i]) -    c2 = Counter(s[i:]) -    res = max(res, len(set(c1.keys()) & set(c2.keys()))) -print(res) +ans = -1 +for mid in range(1, n): +    # [0, mid), [mid, n) +    left = set(s[:mid]) +    right = set(s[mid:]) +    cnt = 0 +    for c in ascii_lowercase: +        if c in left and c in right: +            cnt += 1 +    ans = max(ans, cnt) +print(ans)