N = int(eval(input()))

S = input().strip()

cmax = 0

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

    X = S[:n]

    Y = S[n:]

    Cx = {}

    Cy = {}

    for i in range(n):

        a = X[i]

        if a not in Cx:

            Cx[a] = 0

        Cx[a] += 1

    for i in range(N-n):

        a = Y[i]

        if a not in Cy:

            Cy[a]=0

        Cy[a] += 1

    cnt = 0

    for a in Cx:

        if a in Cy:

            cnt += 1

    cmax = max(cmax,cnt)

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

S = input().strip()

cmax = 0

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

    X = set(list(S[:i]))

    Y = set(list(S[i:]))

    Z = X&Y

    cmax = max(cmax,len(Z))

print(cmax)
N = int(eval(input()))
S = input().strip()
cmax = 0
for n in range(1, N - 1):
    X = S[:n]
    Y = S[n:]
    Cx = {}
    Cy = {}
    for i in range(n):
        a = X[i]
        if a not in Cx:
            Cx[a] = 0
        Cx[a] += 1
    for i in range(N - n):
        a = Y[i]
        if a not in Cy:
            Cy[a] = 0
        Cy[a] += 1
    cnt = 0
    for a in Cx:
        if a in Cy:
            cnt += 1
    cmax = max(cmax, cnt)
print(cmax)

N = int(eval(input()))
S = input().strip()
cmax = 0
for i in range(1, N - 1):
    X = set(list(S[:i]))
    Y = set(list(S[i:]))
    Z = X & Y
    cmax = max(cmax, len(Z))
print(cmax)

-for n in range(1, N - 1): -    X = S[:n] -    Y = S[n:] -    Cx = {} -    Cy = {} -    for i in range(n): -        a = X[i] -        if a not in Cx: -            Cx[a] = 0 -        Cx[a] += 1 -    for i in range(N - n): -        a = Y[i] -        if a not in Cy: -            Cy[a] = 0 -        Cy[a] += 1 -    cnt = 0 -    for a in Cx: -        if a in Cy: -            cnt += 1 -    cmax = max(cmax, cnt) +for i in range(1, N - 1): +    X = set(list(S[:i])) +    Y = set(list(S[i:])) +    Z = X & Y +    cmax = max(cmax, len(Z))