import numpy as np

import sys

n = int(eval(input()))

s = eval(input())

ans = 0

for i in range(n-2):

    count = len(set(s[:i+1]))+len(set(s[i+1:]))-len(set(list(set(s[:i+1]))+list(set(s[i+1:]))))

    ans = max(ans,count)

print(ans)

n=int(eval(input()))

s=eval(input())

ans=0

for i in range(n):

    x=list(set(s[:i+1]))

    y=list(set(s[i+1:]))

    cnt=0

    for j in range(min(len(x),len(y))):

        if i<=n//2:

            if x[j] in y:

                cnt+=1

        else:

            if y[j] in x:

                cnt+=1

    ans=max(ans,cnt)

print(ans)

import numpy as np
import sys

n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(n - 2):
    count = (
        len(set(s[: i + 1]))
        + len(set(s[i + 1 :]))
        - len(set(list(set(s[: i + 1])) + list(set(s[i + 1 :]))))
    )
    ans = max(ans, count)
print(ans)

n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(n):
    x = list(set(s[: i + 1]))
    y = list(set(s[i + 1 :]))
    cnt = 0
    for j in range(min(len(x), len(y))):
        if i <= n // 2:
            if x[j] in y:
                cnt += 1
        else:
            if y[j] in x:
                cnt += 1
    ans = max(ans, cnt)
print(ans)

-import numpy as np -import sys - -for i in range(n - 2): -    count = ( -        len(set(s[: i + 1])) -        + len(set(s[i + 1 :])) -        - len(set(list(set(s[: i + 1])) + list(set(s[i + 1 :])))) -    ) -    ans = max(ans, count) +for i in range(n): +    x = list(set(s[: i + 1])) +    y = list(set(s[i + 1 :])) +    cnt = 0 +    for j in range(min(len(x), len(y))): +        if i <= n // 2: +            if x[j] in y: +                cnt += 1 +        else: +            if y[j] in x: +                cnt += 1 +    ans = max(ans, cnt)