n = int(eval(input()))

s = eval(input())



count = 0

for i in range(1, n):

    temp = set()

    for j in range(i):

        if s[j] in s[i:]:

            temp.add(s[j])

    count = max(len(temp), count)



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

s = eval(input())



count = 0

for i in range(1, n):

    temp = set()

    for j in range(i):

        if s[j] in set(s[i:]):

            temp.add(s[j])

    count = max(len(temp), count)



print(count)
n = int(eval(input()))
s = eval(input())
count = 0
for i in range(1, n):
    temp = set()
    for j in range(i):
        if s[j] in s[i:]:
            temp.add(s[j])
    count = max(len(temp), count)
print(count)

n = int(eval(input()))
s = eval(input())
count = 0
for i in range(1, n):
    temp = set()
    for j in range(i):
        if s[j] in set(s[i:]):
            temp.add(s[j])
    count = max(len(temp), count)
print(count)

-        if s[j] in s[i:]: +        if s[j] in set(s[i:]):