N,S=int(eval(input())),eval(input())

ans=0

for i in range(1,N):

    a,b,c=S[:i],S[i:],0

    for j in range(97,123):

        if chr(j)in a and chr(j)in b:c+=1

    ans=max(ans,c)

print(ans)
N,S,z=int(eval(input())),eval(input()),0

for i in range(1,N):a,b=S[:i],S[i:];z=max(z,len([0 for j in range(97,123)if chr(j)in a and chr(j)in b]))

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

N, S, z = int(eval(input())), eval(input()), 0
for i in range(1, N):
    a, b = S[:i], S[i:]
    z = max(z, len([0 for j in range(97, 123) if chr(j) in a and chr(j) in b]))
print(z)

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