a = int(eval(input()))

b = eval(input())

ans = 0

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

    c = b[:i]

    d = b[i:]

    e = 0

    f = []

    for j in range(len(c)):

        for k in range(len(d)):

            if c[j] == d[k] and c[j] not in f:

                e += 1

                f.append(c[j])

                break

    ans = max(ans, e)

print(ans)

a = int(eval(input()))

b = list(eval(input()))

c = 0

for i in range(a):

    d = {}

    e = {}

    for j in range(0, min(i+1, a)):

        if b[j] not in d:

            d[b[j]] = 1

    for j in range(i+1, a):

        if b[j] in d and b[j] not in e:

            e[b[j]] = 1



    c = max(c, len(e))

print(c)

a = int(eval(input()))
b = eval(input())
ans = 0
for i in range(1, a - 1):
    c = b[:i]
    d = b[i:]
    e = 0
    f = []
    for j in range(len(c)):
        for k in range(len(d)):
            if c[j] == d[k] and c[j] not in f:
                e += 1
                f.append(c[j])
                break
    ans = max(ans, e)
print(ans)

a = int(eval(input()))
b = list(eval(input()))
c = 0
for i in range(a):
    d = {}
    e = {}
    for j in range(0, min(i + 1, a)):
        if b[j] not in d:
            d[b[j]] = 1
    for j in range(i + 1, a):
        if b[j] in d and b[j] not in e:
            e[b[j]] = 1
    c = max(c, len(e))
print(c)

-b = eval(input()) -ans = 0 -for i in range(1, a - 1): -    c = b[:i] -    d = b[i:] -    e = 0 -    f = [] -    for j in range(len(c)): -        for k in range(len(d)): -            if c[j] == d[k] and c[j] not in f: -                e += 1 -                f.append(c[j]) -                break -    ans = max(ans, e) -print(ans) +b = list(eval(input())) +c = 0 +for i in range(a): +    d = {} +    e = {} +    for j in range(0, min(i + 1, a)): +        if b[j] not in d: +            d[b[j]] = 1 +    for j in range(i + 1, a): +        if b[j] in d and b[j] not in e: +            e[b[j]] = 1 +    c = max(c, len(e)) +print(c)