from collections import Counter

N = int(eval(input()))

S = eval(input())

mx = 0

for i in range(1,N):

    pre = Counter(S[:i])

    back = Counter(S[i:])

    tmp = 0

    for k in list(pre.keys()):

        if k in back:

            tmp += 1

    mx = max(mx, tmp)

print(mx)

from collections import Counter

n = int(eval(input()))

s = eval(input())



ans = 0

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

    a = Counter(s[:i])

    b = Counter(s[i:])

    cnt = 0

    for k in list(a.keys()):

        if k in b:

            cnt += 1

    if cnt > ans:

        ans = cnt

print(ans)
from collections import Counter

N = int(eval(input()))
S = eval(input())
mx = 0
for i in range(1, N):
    pre = Counter(S[:i])
    back = Counter(S[i:])
    tmp = 0
    for k in list(pre.keys()):
        if k in back:
            tmp += 1
    mx = max(mx, tmp)
print(mx)

from collections import Counter

n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(1, n - 1):
    a = Counter(s[:i])
    b = Counter(s[i:])
    cnt = 0
    for k in list(a.keys()):
        if k in b:
            cnt += 1
    if cnt > ans:
        ans = cnt
print(ans)

-N = int(eval(input())) -S = eval(input()) -mx = 0 -for i in range(1, N): -    pre = Counter(S[:i]) -    back = Counter(S[i:]) -    tmp = 0 -    for k in list(pre.keys()): -        if k in back: -            tmp += 1 -    mx = max(mx, tmp) -print(mx) +n = int(eval(input())) +s = eval(input()) +ans = 0 +for i in range(1, n - 1): +    a = Counter(s[:i]) +    b = Counter(s[i:]) +    cnt = 0 +    for k in list(a.keys()): +        if k in b: +            cnt += 1 +    if cnt > ans: +        ans = cnt +print(ans)