n = int(eval(input()))

s = eval(input())



ans = 0

for i in range(1,n):

  t = len(set(s[:i]) & set(s[i:]))

  if ans < t: ans = t

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

s = list(eval(input()))



ans = 0

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

  t = len(set(s[:i]) & set(s[i:]))

  if ans < t: ans = t

print(ans)
n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(1, n):
    t = len(set(s[:i]) & set(s[i:]))
    if ans < t:
        ans = t
print(ans)

n = int(eval(input()))
s = list(eval(input()))
ans = 0
for i in range(1, n - 1):
    t = len(set(s[:i]) & set(s[i:]))
    if ans < t:
        ans = t
print(ans)

-s = eval(input()) +s = list(eval(input())) -for i in range(1, n): +for i in range(1, n - 1):