N = int(eval(input()))

S = eval(input())



ans = 0

for i in range(1, N):

    ans = max(ans, len(set(list(S[:i])) & set(list(S[i:]))))



print(ans)
N = int(eval(input()))

S = eval(input())



ans = 0

for i in range(1, N):

    s1 = set(list(S[:i]))

    s2 = set(list(S[i:]))

    ans = max(ans, len(s1 & s2))



print(ans)

N = int(eval(input()))
S = eval(input())
ans = 0
for i in range(1, N):
    ans = max(ans, len(set(list(S[:i])) & set(list(S[i:]))))
print(ans)

N = int(eval(input()))
S = eval(input())
ans = 0
for i in range(1, N):
    s1 = set(list(S[:i]))
    s2 = set(list(S[i:]))
    ans = max(ans, len(s1 & s2))
print(ans)

-    ans = max(ans, len(set(list(S[:i])) & set(list(S[i:])))) +    s1 = set(list(S[:i])) +    s2 = set(list(S[i:])) +    ans = max(ans, len(s1 & s2))