def main() -> None:

    N = int(eval(input()))

    S = eval(input())

    m = 0

    for i in range(N):

        l1 = S[0:i]

        l2 = S[i:]

        if m < len(set(sorted(l1)) & set(sorted(l2))):

            m = len(set(sorted(l1)) & set(sorted(l2)))

    

    print(m)





if __name__ == '__main__':

    main()

def main() -> None:

    N = int(eval(input()))

    S = eval(input())

    m = 0

    for i in range(N):

        same_num = len(set(sorted(S[0:i])) & set(sorted(S[i:])))

        m = same_num if m < same_num else m

    

    print(m)





if __name__ == '__main__':

    main()

def main() -> None:
    N = int(eval(input()))
    S = eval(input())
    m = 0
    for i in range(N):
        l1 = S[0:i]
        l2 = S[i:]
        if m < len(set(sorted(l1)) & set(sorted(l2))):
            m = len(set(sorted(l1)) & set(sorted(l2)))
    print(m)


if __name__ == "__main__":
    main()

def main() -> None:
    N = int(eval(input()))
    S = eval(input())
    m = 0
    for i in range(N):
        same_num = len(set(sorted(S[0:i])) & set(sorted(S[i:])))
        m = same_num if m < same_num else m
    print(m)


if __name__ == "__main__":
    main()

-        l1 = S[0:i] -        l2 = S[i:] -        if m < len(set(sorted(l1)) & set(sorted(l2))): -            m = len(set(sorted(l1)) & set(sorted(l2))) +        same_num = len(set(sorted(S[0:i])) & set(sorted(S[i:]))) +        m = same_num if m < same_num else m