def func(s1, s2):

    set1 = set(s1)

    set2 = set(s2)



    cnt = 0

    for _ in range(len(set1)):

        s = set1.pop()

        if s in set2:

            cnt += 1

    return cnt





def main():

    n = int(eval(input()))

    s = eval(input())



    mx = 0

    for i in range(len(s) - 1):

        s1 = s[:i + 1]

        s2 = s[i + 1:]

        ans = func(s1, s2)

        if ans > mx:

            mx = ans



    print(mx)





if __name__ == '__main__':

    main()

    # print(func([1, 2, 2, 3], [2, 3, 4, 4, 1]))

def check(s1, s2):

    ss1 = set(s1)

    ss2 = set(s2)

    count = 0

    for si in ss1:

        if si in ss2:

            count += 1;

    return count





def main():

    n = int(eval(input()))

    s = eval(input())



    mx = 0

    for i in range(1, len(s)):

        s1 = s[:i]

        s2 = s[i:]

        mx = max(check(s1, s2), mx)



    print(mx)





if __name__ == '__main__':

    main()

def func(s1, s2):
    set1 = set(s1)
    set2 = set(s2)
    cnt = 0
    for _ in range(len(set1)):
        s = set1.pop()
        if s in set2:
            cnt += 1
    return cnt


def main():
    n = int(eval(input()))
    s = eval(input())
    mx = 0
    for i in range(len(s) - 1):
        s1 = s[: i + 1]
        s2 = s[i + 1 :]
        ans = func(s1, s2)
        if ans > mx:
            mx = ans
    print(mx)


if __name__ == "__main__":
    main()
    # print(func([1, 2, 2, 3], [2, 3, 4, 4, 1]))

def check(s1, s2):
    ss1 = set(s1)
    ss2 = set(s2)
    count = 0
    for si in ss1:
        if si in ss2:
            count += 1
    return count


def main():
    n = int(eval(input()))
    s = eval(input())
    mx = 0
    for i in range(1, len(s)):
        s1 = s[:i]
        s2 = s[i:]
        mx = max(check(s1, s2), mx)
    print(mx)


if __name__ == "__main__":
    main()

-def func(s1, s2): -    set1 = set(s1) -    set2 = set(s2) -    cnt = 0 -    for _ in range(len(set1)): -        s = set1.pop() -        if s in set2: -            cnt += 1 -    return cnt +def check(s1, s2): +    ss1 = set(s1) +    ss2 = set(s2) +    count = 0 +    for si in ss1: +        if si in ss2: +            count += 1 +    return count -    for i in range(len(s) - 1): -        s1 = s[: i + 1] -        s2 = s[i + 1 :] -        ans = func(s1, s2) -        if ans > mx: -            mx = ans +    for i in range(1, len(s)): +        s1 = s[:i] +        s2 = s[i:] +        mx = max(check(s1, s2), mx) -    # print(func([1, 2, 2, 3], [2, 3, 4, 4, 1]))