N=int(eval(input()))

S=eval(input())



#Tに含まれた文字の種類を数える

def countletter(T):

    S=[]

    for t in T:

        if t not in S:

            S.append(t)

    return len(S)



ans=0



for i in range(1,N):

    A=S[:i]

    B=S[i:]

    

    ans=max(ans,countletter(A)+countletter(B)-countletter(S))

    

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

S=eval(input())

ans=0

for i in range(1,N):

    A=set(S[:i])

    B=set(S[i:])

    ans=max(ans,len(A&B))

print(ans)
N = int(eval(input()))
S = eval(input())
# Tに含まれた文字の種類を数える
def countletter(T):
    S = []
    for t in T:
        if t not in S:
            S.append(t)
    return len(S)


ans = 0
for i in range(1, N):
    A = S[:i]
    B = S[i:]
    ans = max(ans, countletter(A) + countletter(B) - countletter(S))
print(ans)

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

-# Tに含まれた文字の種類を数える -def countletter(T): -    S = [] -    for t in T: -        if t not in S: -            S.append(t) -    return len(S) - - -    A = S[:i] -    B = S[i:] -    ans = max(ans, countletter(A) + countletter(B) - countletter(S)) +    A = set(S[:i]) +    B = set(S[i:]) +    ans = max(ans, len(A & B))