n = int(eval(input()))

s = eval(input())

ans = 0

for i in range(n):

    a = list(set(s[:i]))

    b = list(set(s[i:]))

    l_a = len(a)

    l_b = len(b)

    c = list(set(a+b))

    l_c = len(c)

    ans = max(ans,l_a+l_b-l_c)

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

s = eval(input())

result_list = list()

for i in range(n):

    x = s[:i+1]

    y = s[i+1:]

    comon_set_len = len(set(ii for ii in x) & set(iii for iii in y))

    result_list.append(comon_set_len)

result_list.sort(reverse = True)

print((result_list[0]))
n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(n):
    a = list(set(s[:i]))
    b = list(set(s[i:]))
    l_a = len(a)
    l_b = len(b)
    c = list(set(a + b))
    l_c = len(c)
    ans = max(ans, l_a + l_b - l_c)
print(ans)

n = int(eval(input())) - 1
s = eval(input())
result_list = list()
for i in range(n):
    x = s[: i + 1]
    y = s[i + 1 :]
    comon_set_len = len(set(ii for ii in x) & set(iii for iii in y))
    result_list.append(comon_set_len)
result_list.sort(reverse=True)
print((result_list[0]))

-n = int(eval(input())) +n = int(eval(input())) - 1 -ans = 0 +result_list = list() -    a = list(set(s[:i])) -    b = list(set(s[i:])) -    l_a = len(a) -    l_b = len(b) -    c = list(set(a + b)) -    l_c = len(c) -    ans = max(ans, l_a + l_b - l_c) -print(ans) +    x = s[: i + 1] +    y = s[i + 1 :] +    comon_set_len = len(set(ii for ii in x) & set(iii for iii in y)) +    result_list.append(comon_set_len) +result_list.sort(reverse=True) +print((result_list[0]))