from collections import Counter as C

n = int(eval(input()))

s = eval(input())



res = 0

for i in range(1,n):

    a = s[:i]

    b = s[i:]

    tmp = 0

    for k in C(a):

        if k in b:

            tmp += 1

    res = max(res,tmp)

print(res)

n = int(eval(input()))

s = eval(input())

res = 0

for i in range(1,n):

    b,c =(s[:i], s[i:])

    cnt = 0

    for j in range(26):

        p = chr(ord('a') + j)

        cnt += (p in b) and (p in c)

    res = max(res, cnt)

print(res)

from collections import Counter as C

n = int(eval(input()))
s = eval(input())
res = 0
for i in range(1, n):
    a = s[:i]
    b = s[i:]
    tmp = 0
    for k in C(a):
        if k in b:
            tmp += 1
    res = max(res, tmp)
print(res)

n = int(eval(input()))
s = eval(input())
res = 0
for i in range(1, n):
    b, c = (s[:i], s[i:])
    cnt = 0
    for j in range(26):
        p = chr(ord("a") + j)
        cnt += (p in b) and (p in c)
    res = max(res, cnt)
print(res)

-from collections import Counter as C - -    a = s[:i] -    b = s[i:] -    tmp = 0 -    for k in C(a): -        if k in b: -            tmp += 1 -    res = max(res, tmp) +    b, c = (s[:i], s[i:]) +    cnt = 0 +    for j in range(26): +        p = chr(ord("a") + j) +        cnt += (p in b) and (p in c) +    res = max(res, cnt)