from collections import Counter

N = int(eval(input()))

S = eval(input())

array = []

for i in range(1,N):

    S1 = list(S[:i])

    S2 = list(S[i:])

    S1c = Counter(S1)

    S2c = Counter(S2)

    suma = 0

    for k in S1c:

        if k in S2c:

            suma += 1

    array.append(suma)

print((max(array)))
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)

    

from collections import Counter

N = int(eval(input()))
S = eval(input())
array = []
for i in range(1, N):
    S1 = list(S[:i])
    S2 = list(S[i:])
    S1c = Counter(S1)
    S2c = Counter(S2)
    suma = 0
    for k in S1c:
        if k in S2c:
            suma += 1
    array.append(suma)
print((max(array)))

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)

-from collections import Counter - -array = [] +ans = 0 -    S1 = list(S[:i]) -    S2 = list(S[i:]) -    S1c = Counter(S1) -    S2c = Counter(S2) -    suma = 0 -    for k in S1c: -        if k in S2c: -            suma += 1 -    array.append(suma) -print((max(array))) +    a = set(S[:i]) +    b = set(S[i:]) +    ans = max(ans, len(a & b)) +print(ans)