# coding: utf-8

# Your code here!



n=int(eval(input()))

S=eval(input())

l=list("0123456789")



ret=[False]*1000

for i in (l):

    for j in (l):

        for k in (l):

            flg1=flg2=False

            for s in S:

                if s==i and not flg1:

                    flg1=True

                    continue

                if flg1 and s==j and not flg2:

                    flg2=True

                    continue

                if flg2 and s==k:

                    tmp=int(i+j+k)

                    # print(tmp)

                    ret[tmp]=True

                    break

          

print((sum(ret)))
n=int(eval(input()))

s=eval(input())

from itertools import product



cnt=0

for i,j in product("0123456789",repeat=2):

    try:

        ind_i=s.index(i)

    except:

        continue

    try:

        ind_j=s.rindex(j)

    except:

        continue

    if ind_i>ind_j:

        continue

    for k in "0123456789":

        cnt+=(k in s[ind_i+1:ind_j])

        

print(cnt)
# coding: utf-8
# Your code here!
n = int(eval(input()))
S = eval(input())
l = list("0123456789")
ret = [False] * 1000
for i in l:
    for j in l:
        for k in l:
            flg1 = flg2 = False
            for s in S:
                if s == i and not flg1:
                    flg1 = True
                    continue
                if flg1 and s == j and not flg2:
                    flg2 = True
                    continue
                if flg2 and s == k:
                    tmp = int(i + j + k)
                    # print(tmp)
                    ret[tmp] = True
                    break
print((sum(ret)))

n = int(eval(input()))
s = eval(input())
from itertools import product

cnt = 0
for i, j in product("0123456789", repeat=2):
    try:
        ind_i = s.index(i)
    except:
        continue
    try:
        ind_j = s.rindex(j)
    except:
        continue
    if ind_i > ind_j:
        continue
    for k in "0123456789":
        cnt += k in s[ind_i + 1 : ind_j]
print(cnt)

-# coding: utf-8 -# Your code here! -S = eval(input()) -l = list("0123456789") -ret = [False] * 1000 -for i in l: -    for j in l: -        for k in l: -            flg1 = flg2 = False -            for s in S: -                if s == i and not flg1: -                    flg1 = True -                    continue -                if flg1 and s == j and not flg2: -                    flg2 = True -                    continue -                if flg2 and s == k: -                    tmp = int(i + j + k) -                    # print(tmp) -                    ret[tmp] = True -                    break -print((sum(ret))) +s = eval(input()) +from itertools import product + +cnt = 0 +for i, j in product("0123456789", repeat=2): +    try: +        ind_i = s.index(i) +    except: +        continue +    try: +        ind_j = s.rindex(j) +    except: +        continue +    if ind_i > ind_j: +        continue +    for k in "0123456789": +        cnt += k in s[ind_i + 1 : ind_j] +print(cnt)