n = int(eval(input()))

s = eval(input())



ans = 0

for i in range(n):

    d = {}

    for j in s[:i]:

        if d.get(j, 0) == 0:

            d[j] = 1

    for j in s[i:]:

        if d.get(j, 0) == 1:

            d[j] = 2

    t = 0

    for j in d:

        if d[j] == 2:

            t += 1

    ans = max(ans, t)



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

s = eval(input())



ans = 0

for i in range(1, n):

    head = s[:i]

    tail = s[i:]

    cnt = 0

    for i in range(26):

        c = chr(ord('a') + i)

        if c in head and c in tail:

            cnt += 1



    ans = max(ans, cnt)



print(ans)
n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(n):
    d = {}
    for j in s[:i]:
        if d.get(j, 0) == 0:
            d[j] = 1
    for j in s[i:]:
        if d.get(j, 0) == 1:
            d[j] = 2
    t = 0
    for j in d:
        if d[j] == 2:
            t += 1
    ans = max(ans, t)
print(ans)

n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(1, n):
    head = s[:i]
    tail = s[i:]
    cnt = 0
    for i in range(26):
        c = chr(ord("a") + i)
        if c in head and c in tail:
            cnt += 1
    ans = max(ans, cnt)
print(ans)

-for i in range(n): -    d = {} -    for j in s[:i]: -        if d.get(j, 0) == 0: -            d[j] = 1 -    for j in s[i:]: -        if d.get(j, 0) == 1: -            d[j] = 2 -    t = 0 -    for j in d: -        if d[j] == 2: -            t += 1 -    ans = max(ans, t) +for i in range(1, n): +    head = s[:i] +    tail = s[i:] +    cnt = 0 +    for i in range(26): +        c = chr(ord("a") + i) +        if c in head and c in tail: +            cnt += 1 +    ans = max(ans, cnt)