from collections import Counter



N=int(eval(input()))

S=eval(input())



ans=0

X=Counter()

Y=Counter(S)

for c in S:

    Y[c]-=1

    if Y[c]==0:

        del X[c]

    else:

        X[c]+=1

    ans=max(ans,len(X))

       



print(ans)

N=int(eval(input()))

S=eval(input())



ans=0

for i in range(1,N-1):

    a=[0]*26

    for j in range(i):

        a[ord(S[j])-97]|=1

    for j in range(i,N):

        a[ord(S[j])-97]|=2

    ans=max(ans,a.count(3))



print(ans)

from collections import Counter

N = int(eval(input()))
S = eval(input())
ans = 0
X = Counter()
Y = Counter(S)
for c in S:
    Y[c] -= 1
    if Y[c] == 0:
        del X[c]
    else:
        X[c] += 1
    ans = max(ans, len(X))
print(ans)

N = int(eval(input()))
S = eval(input())
ans = 0
for i in range(1, N - 1):
    a = [0] * 26
    for j in range(i):
        a[ord(S[j]) - 97] |= 1
    for j in range(i, N):
        a[ord(S[j]) - 97] |= 2
    ans = max(ans, a.count(3))
print(ans)

-from collections import Counter - -X = Counter() -Y = Counter(S) -for c in S: -    Y[c] -= 1 -    if Y[c] == 0: -        del X[c] -    else: -        X[c] += 1 -    ans = max(ans, len(X)) +for i in range(1, N - 1): +    a = [0] * 26 +    for j in range(i): +        a[ord(S[j]) - 97] |= 1 +    for j in range(i, N): +        a[ord(S[j]) - 97] |= 2 +    ans = max(ans, a.count(3))