import string



def f(s, t):

    ret = 0

    for c in string.ascii_lowercase:

        found_s = False

        found_t = False

        for i in range(len(s)):

            if s[i] == c:

                found_s = True

                break

        for i in range(len(t)):

            if t[i] == c:

                found_t = True

                break

        if found_s and found_t:

            ret += 1

    return ret

    

if __name__ == '__main__':

    n = int(eval(input()))

    s = eval(input())



    ans = 0

    for i in range(n + 1):

        #i文字目が壁になる

        #0文字目の手前まで:空文字列

        #n+1文字目の手前まで:全文字列

        tmp = f(s[:i], s[i:]) 

        ans = max(ans, tmp)

    print(ans)
n = int(eval(input()))

s = eval(input())



ans = 0

for i in range(n):

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

print(ans)
import string


def f(s, t):
    ret = 0
    for c in string.ascii_lowercase:
        found_s = False
        found_t = False
        for i in range(len(s)):
            if s[i] == c:
                found_s = True
                break
        for i in range(len(t)):
            if t[i] == c:
                found_t = True
                break
        if found_s and found_t:
            ret += 1
    return ret


if __name__ == "__main__":
    n = int(eval(input()))
    s = eval(input())
    ans = 0
    for i in range(n + 1):
        # i文字目が壁になる
        # 0文字目の手前まで:空文字列
        # n+1文字目の手前まで:全文字列
        tmp = f(s[:i], s[i:])
        ans = max(ans, tmp)
    print(ans)

n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(n):
    ans = max(ans, len(set(s[:i]) & set(s[i:])))
print(ans)

-import string - - -def f(s, t): -    ret = 0 -    for c in string.ascii_lowercase: -        found_s = False -        found_t = False -        for i in range(len(s)): -            if s[i] == c: -                found_s = True -                break -        for i in range(len(t)): -            if t[i] == c: -                found_t = True -                break -        if found_s and found_t: -            ret += 1 -    return ret - - -if __name__ == "__main__": -    n = int(eval(input())) -    s = eval(input()) -    ans = 0 -    for i in range(n + 1): -        # i文字目が壁になる -        # 0文字目の手前まで:空文字列 -        # n+1文字目の手前まで:全文字列 -        tmp = f(s[:i], s[i:]) -        ans = max(ans, tmp) -    print(ans) +n = int(eval(input())) +s = eval(input()) +ans = 0 +for i in range(n): +    ans = max(ans, len(set(s[:i]) & set(s[i:]))) +print(ans)