n=int(eval(input()))

s=eval(input())

st='abcdefghijklmnopqrstuvwxyz'

ans=0

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

    ll=[0]*26

    rl=[0]*26

    for j in range(i):

        ll[st.index(s[j])]+=1

    for j in range(i,n):

        rl[st.index(s[j])]+=1

    cnt=0

    for j in range(26):

        cnt+=1 if ll[j]>0 and rl[j]>0 else 0

    ans=max(ans,cnt)

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

s=eval(input())

ans=0

for i in range(n):

    t1=set(s[:i])

    t2=set(s[i:])

    ans=max(ans,len(t1&t2))

print(ans)
n = int(eval(input()))
s = eval(input())
st = "abcdefghijklmnopqrstuvwxyz"
ans = 0
for i in range(1, n - 1):
    ll = [0] * 26
    rl = [0] * 26
    for j in range(i):
        ll[st.index(s[j])] += 1
    for j in range(i, n):
        rl[st.index(s[j])] += 1
    cnt = 0
    for j in range(26):
        cnt += 1 if ll[j] > 0 and rl[j] > 0 else 0
    ans = max(ans, cnt)
print(ans)

n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(n):
    t1 = set(s[:i])
    t2 = set(s[i:])
    ans = max(ans, len(t1 & t2))
print(ans)

-st = "abcdefghijklmnopqrstuvwxyz" -for i in range(1, n - 1): -    ll = [0] * 26 -    rl = [0] * 26 -    for j in range(i): -        ll[st.index(s[j])] += 1 -    for j in range(i, n): -        rl[st.index(s[j])] += 1 -    cnt = 0 -    for j in range(26): -        cnt += 1 if ll[j] > 0 and rl[j] > 0 else 0 -    ans = max(ans, cnt) +for i in range(n): +    t1 = set(s[:i]) +    t2 = set(s[i:]) +    ans = max(ans, len(t1 & t2))