import sys

import collections

from collections import Counter

input = sys.stdin.readline

N = int(eval(input()))

S = list(eval(input()))

count = -1000

del S[-1]

for i in range(N) :

    a = 0

    Sa = S[:i]

    Sb = S[i:]

    ca = collections.Counter(Sa)

    cb = collections.Counter(Sb)

    ka = list(ca.keys())

    kb = list(cb.keys())

    for j in ka :

        for k in kb :

            if j == k :

                a +=1

    count = max(a,count)

print(count)
#template

def inputlist(): return [int(j) for j in input().split()]

from collections import Counter

#template

#issueから始める

N = int(eval(input()))

s = list(eval(input()))

ans = -1

for i in range(N):

    lif = s[:i]

    lib = s[i:]

    cf= list(Counter(lif).keys())

    cb= list(Counter(lib).keys())

    k = len(cf) + len(cb) - len(set(cf+cb))

    ans = max(ans,k)

print(ans)
import sys
import collections
from collections import Counter

input = sys.stdin.readline
N = int(eval(input()))
S = list(eval(input()))
count = -1000
del S[-1]
for i in range(N):
    a = 0
    Sa = S[:i]
    Sb = S[i:]
    ca = collections.Counter(Sa)
    cb = collections.Counter(Sb)
    ka = list(ca.keys())
    kb = list(cb.keys())
    for j in ka:
        for k in kb:
            if j == k:
                a += 1
    count = max(a, count)
print(count)

# template
def inputlist():
    return [int(j) for j in input().split()]


from collections import Counter

# template
# issueから始める
N = int(eval(input()))
s = list(eval(input()))
ans = -1
for i in range(N):
    lif = s[:i]
    lib = s[i:]
    cf = list(Counter(lif).keys())
    cb = list(Counter(lib).keys())
    k = len(cf) + len(cb) - len(set(cf + cb))
    ans = max(ans, k)
print(ans)

-import sys -import collections +# template +def inputlist(): +    return [int(j) for j in input().split()] + + -input = sys.stdin.readline +# template +# issueから始める -S = list(eval(input())) -count = -1000 -del S[-1] +s = list(eval(input())) +ans = -1 -    a = 0 -    Sa = S[:i] -    Sb = S[i:] -    ca = collections.Counter(Sa) -    cb = collections.Counter(Sb) -    ka = list(ca.keys()) -    kb = list(cb.keys()) -    for j in ka: -        for k in kb: -            if j == k: -                a += 1 -    count = max(a, count) -print(count) +    lif = s[:i] +    lib = s[i:] +    cf = list(Counter(lif).keys()) +    cb = list(Counter(lib).keys()) +    k = len(cf) + len(cb) - len(set(cf + cb)) +    ans = max(ans, k) +print(ans)