N = int(eval(input()))

S = eval(input())

L = []

for i in range(1, N):

    a = set()

    b = set()

    for j in S[:i]:

        a.add(j)

    for k in S[i:]:

        b.add(k)

    count = len(a & b)

    L.append(count)



print((max(L)))

N = int(eval(input()))

S = eval(input())



cnt = 0



for i in range(N-1):

    a = S[:i+1]

    b = S[i+1:]

    a = set(a)

    b = set(b)

    cnt = max(cnt, len(a & b))



print(cnt)

    
N = int(eval(input()))
S = eval(input())
L = []
for i in range(1, N):
    a = set()
    b = set()
    for j in S[:i]:
        a.add(j)
    for k in S[i:]:
        b.add(k)
    count = len(a & b)
    L.append(count)
print((max(L)))

N = int(eval(input()))
S = eval(input())
cnt = 0
for i in range(N - 1):
    a = S[: i + 1]
    b = S[i + 1 :]
    a = set(a)
    b = set(b)
    cnt = max(cnt, len(a & b))
print(cnt)

-L = [] -for i in range(1, N): -    a = set() -    b = set() -    for j in S[:i]: -        a.add(j) -    for k in S[i:]: -        b.add(k) -    count = len(a & b) -    L.append(count) -print((max(L))) +cnt = 0 +for i in range(N - 1): +    a = S[: i + 1] +    b = S[i + 1 :] +    a = set(a) +    b = set(b) +    cnt = max(cnt, len(a & b)) +print(cnt)