import collections,sys

def S(): return sys.stdin.readline().rstrip()

def I(): return int(sys.stdin.readline().rstrip())

N = I()

S = S()

ans = 0

for i in range(N):

    set_top = set()

    set_bottom = set()

    for s in collections.Counter(S[:i]):

        set_top.add(s)

    for s in collections.Counter(S[i:]):

        set_bottom.add(s)

    ans = max(ans,len(set_top&set_bottom))

print(ans)

import sys

def S(): return sys.stdin.readline().rstrip()

def I(): return int(sys.stdin.readline().rstrip())

N = I()

S = S()

ans = 0

for i in range(N):

    ans = max(ans,len(set(S[:i])&set(S[i:])))

print(ans)

import collections, sys


def S():
    return sys.stdin.readline().rstrip()


def I():
    return int(sys.stdin.readline().rstrip())


N = I()
S = S()
ans = 0
for i in range(N):
    set_top = set()
    set_bottom = set()
    for s in collections.Counter(S[:i]):
        set_top.add(s)
    for s in collections.Counter(S[i:]):
        set_bottom.add(s)
    ans = max(ans, len(set_top & set_bottom))
print(ans)

import sys


def S():
    return sys.stdin.readline().rstrip()


def I():
    return int(sys.stdin.readline().rstrip())


N = I()
S = S()
ans = 0
for i in range(N):
    ans = max(ans, len(set(S[:i]) & set(S[i:])))
print(ans)

-import collections, sys +import sys -    set_top = set() -    set_bottom = set() -    for s in collections.Counter(S[:i]): -        set_top.add(s) -    for s in collections.Counter(S[i:]): -        set_bottom.add(s) -    ans = max(ans, len(set_top & set_bottom)) +    ans = max(ans, len(set(S[:i]) & set(S[i:])))