import collections

N = int(eval(input()))

Y = list(eval(input()))

X = []

ans = 0

for n in range(N):

    X.append(Y.pop(0))

    X_and_Y = set(X) & set(Y)

    ans = max(ans,len(X_and_Y))

print(ans)

N = int(eval(input()))

S = eval(input())

ans = 0

for i in range(N):

    a = S[:i+1]

    b = S[i+1:]

    c = 0

    for j in range(26):

        if chr(j+97) in a and chr(j+97) in b:

            c += 1

    ans = max(ans,c)

print(ans)
import collections

N = int(eval(input()))
Y = list(eval(input()))
X = []
ans = 0
for n in range(N):
    X.append(Y.pop(0))
    X_and_Y = set(X) & set(Y)
    ans = max(ans, len(X_and_Y))
print(ans)

N = int(eval(input()))
S = eval(input())
ans = 0
for i in range(N):
    a = S[: i + 1]
    b = S[i + 1 :]
    c = 0
    for j in range(26):
        if chr(j + 97) in a and chr(j + 97) in b:
            c += 1
    ans = max(ans, c)
print(ans)

-import collections - -Y = list(eval(input())) -X = [] +S = eval(input()) -for n in range(N): -    X.append(Y.pop(0)) -    X_and_Y = set(X) & set(Y) -    ans = max(ans, len(X_and_Y)) +for i in range(N): +    a = S[: i + 1] +    b = S[i + 1 :] +    c = 0 +    for j in range(26): +        if chr(j + 97) in a and chr(j + 97) in b: +            c += 1 +    ans = max(ans, c)