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())

ans = 0

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

  a = set(s[:i])

  b = set(s[i:])

  if ans < len(a & b):

    ans = len(a & b)

print(ans)
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())
ans = 0
for i in range(1, n - 1):
    a = set(s[:i])
    b = set(s[i:])
    if ans < len(a & b):
        ans = len(a & b)
print(ans)

-from collections import Counter - -    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 +    a = set(s[:i]) +    b = set(s[i:]) +    if ans < len(a & b): +        ans = len(a & b)