from collections import Counter



x=int(eval(input()))

n=str(eval(input()))





#print(countN)

#abc

aaa=set([])

result=0

for i in range(x-2):

    a=n[i]

    if a not in aaa:

        aaa.add(a)

        bbb=set([])

        for j in range(i+1,x-1):

            b=n[j]

            if b not in bbb:

                bbb.add(b)

                ccc=set([])

                for k in range(j+1,x):

                    c=n[k]

                    if c not in ccc:

                        ccc.add(c)

                        result+=1

    if len(aaa)==10:

        break

print(result)







        



        

        





from collections import Counter



x=int(eval(input()))

n=str(eval(input()))





#print(countN)

#abc

aaa=set([])

result=0

for i in range(x-2):

    a=n[i]

    if a not in aaa:

        aaa.add(a)

        bbb=set([])

        for j in range(i+1,x-1):

            b=n[j]

            if b not in bbb:

                bbb.add(b)

                ccc=set([])

                for k in range(j+1,x):

                    c=n[k]

                    if c not in ccc:

                        ccc.add(c)

                        result+=1

                    if len(ccc)==10:

                      break

                

                if len(bbb)==10:

                  break

    if len(aaa)==10:

        break

print(result)







        



        

        





from collections import Counter

x = int(eval(input()))
n = str(eval(input()))
# print(countN)
# abc
aaa = set([])
result = 0
for i in range(x - 2):
    a = n[i]
    if a not in aaa:
        aaa.add(a)
        bbb = set([])
        for j in range(i + 1, x - 1):
            b = n[j]
            if b not in bbb:
                bbb.add(b)
                ccc = set([])
                for k in range(j + 1, x):
                    c = n[k]
                    if c not in ccc:
                        ccc.add(c)
                        result += 1
    if len(aaa) == 10:
        break
print(result)

from collections import Counter

x = int(eval(input()))
n = str(eval(input()))
# print(countN)
# abc
aaa = set([])
result = 0
for i in range(x - 2):
    a = n[i]
    if a not in aaa:
        aaa.add(a)
        bbb = set([])
        for j in range(i + 1, x - 1):
            b = n[j]
            if b not in bbb:
                bbb.add(b)
                ccc = set([])
                for k in range(j + 1, x):
                    c = n[k]
                    if c not in ccc:
                        ccc.add(c)
                        result += 1
                    if len(ccc) == 10:
                        break
                if len(bbb) == 10:
                    break
    if len(aaa) == 10:
        break
print(result)

+                    if len(ccc) == 10: +                        break +                if len(bbb) == 10: +                    break