def main():

    n, s = int(eval(input())), eval(input())



    c_lst = []

    for i in range(1, n):

        s1, s2 = s[:i], s[i:]



        s1_dic = {chr(j):0 for j in range(ord('a'), ord('a')+26)}

        for j in range(len(s1)):

            s1_dic[s1[j]] = s1_dic.get(s1[j], 0) + 1



        s2_dic = {chr(j): 0 for j in range(ord('a'), ord('a') + 26)}

        for j in range(len(s2)):

            s2_dic[s2[j]] = s2_dic.get(s2[j], 0) + 1



        cnt = 0

        for k in s1_dic:

            if s1_dic[k] != 0 and s2_dic[k] != 0:

                cnt += 1



        c_lst.append(cnt)



    print((max(c_lst)))





if __name__ == '__main__':

    main()

def main():

    n, s = int(eval(input())), eval(input())



    c_lst = []

    for i in range(n):

        s1, s2 = set(s[:i]), set(s[i:])

        c_lst.append(len(s1&s2))



    print((max(c_lst)))





if __name__ == '__main__':

    main()

def main():
    n, s = int(eval(input())), eval(input())
    c_lst = []
    for i in range(1, n):
        s1, s2 = s[:i], s[i:]
        s1_dic = {chr(j): 0 for j in range(ord("a"), ord("a") + 26)}
        for j in range(len(s1)):
            s1_dic[s1[j]] = s1_dic.get(s1[j], 0) + 1
        s2_dic = {chr(j): 0 for j in range(ord("a"), ord("a") + 26)}
        for j in range(len(s2)):
            s2_dic[s2[j]] = s2_dic.get(s2[j], 0) + 1
        cnt = 0
        for k in s1_dic:
            if s1_dic[k] != 0 and s2_dic[k] != 0:
                cnt += 1
        c_lst.append(cnt)
    print((max(c_lst)))


if __name__ == "__main__":
    main()

def main():
    n, s = int(eval(input())), eval(input())
    c_lst = []
    for i in range(n):
        s1, s2 = set(s[:i]), set(s[i:])
        c_lst.append(len(s1 & s2))
    print((max(c_lst)))


if __name__ == "__main__":
    main()

-    for i in range(1, n): -        s1, s2 = s[:i], s[i:] -        s1_dic = {chr(j): 0 for j in range(ord("a"), ord("a") + 26)} -        for j in range(len(s1)): -            s1_dic[s1[j]] = s1_dic.get(s1[j], 0) + 1 -        s2_dic = {chr(j): 0 for j in range(ord("a"), ord("a") + 26)} -        for j in range(len(s2)): -            s2_dic[s2[j]] = s2_dic.get(s2[j], 0) + 1 -        cnt = 0 -        for k in s1_dic: -            if s1_dic[k] != 0 and s2_dic[k] != 0: -                cnt += 1 -        c_lst.append(cnt) +    for i in range(n): +        s1, s2 = set(s[:i]), set(s[i:]) +        c_lst.append(len(s1 & s2))