N = int(eval(input()))

S = list(eval(input()))

s = set(S)

count = 0

maxx = 0

for i in range(N): #切断場所

    for k in range(i):

        if S[k] in S[:i] and S[k] in S[i:] and S[k] not in S[:k]:

            count += 1

    maxx = max(maxx, count)

    count = 0

print(maxx)
N = int(eval(input()))

S = eval(input())

s = set(S)

count = 0

maxx = 0

for i in range(N): #切断場所

    for k in range(i):

        if S[k] in S[:i] and S[k] in S[i:] and S[k] not in S[:k]:

            count += 1

    maxx = max(maxx, count)

    count = 0

print(maxx)
N = int(eval(input()))
S = list(eval(input()))
s = set(S)
count = 0
maxx = 0
for i in range(N):  # 切断場所
    for k in range(i):
        if S[k] in S[:i] and S[k] in S[i:] and S[k] not in S[:k]:
            count += 1
    maxx = max(maxx, count)
    count = 0
print(maxx)

N = int(eval(input()))
S = eval(input())
s = set(S)
count = 0
maxx = 0
for i in range(N):  # 切断場所
    for k in range(i):
        if S[k] in S[:i] and S[k] in S[i:] and S[k] not in S[:k]:
            count += 1
    maxx = max(maxx, count)
    count = 0
print(maxx)

-S = list(eval(input())) +S = eval(input())