N = int(eval(input()))

S = eval(input())



K = []

for i in range(1,N):

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

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

    cnt = 0

    for i in range(len(X)):

        if X[i] in Y:

            cnt += 1



    K.append(cnt)



print((max(K)))
N = int(eval(input()))

S = eval(input())



K = []

for i in range(1,N):

    X = set(S[:i])

    Y = set(S[i:])

    K.append(len(X & Y))



print((max(K)))
N = int(eval(input()))
S = eval(input())
K = []
for i in range(1, N):
    X = list(set(S[:i]))
    Y = list(set(S[i:]))
    cnt = 0
    for i in range(len(X)):
        if X[i] in Y:
            cnt += 1
    K.append(cnt)
print((max(K)))

N = int(eval(input()))
S = eval(input())
K = []
for i in range(1, N):
    X = set(S[:i])
    Y = set(S[i:])
    K.append(len(X & Y))
print((max(K)))

-    X = list(set(S[:i])) -    Y = list(set(S[i:])) -    cnt = 0 -    for i in range(len(X)): -        if X[i] in Y: -            cnt += 1 -    K.append(cnt) +    X = set(S[:i]) +    Y = set(S[i:]) +    K.append(len(X & Y))