n = int(eval(input()))

num_list = list(map(int,eval(input())))



cnt = 0



for i in range(10):

    if i not in num_list:

        continue

    else:

        first_pwd = num_list.index(i)

        new_num_list = num_list[first_pwd + 1:]

        for j in range(10):

            if j not in new_num_list:

                continue

            else:

                second_pwd = new_num_list.index(j)

                new_new_num_list = new_num_list[second_pwd+1:]

                for k in range(10):

                    if k not in new_new_num_list:

                        continue

                    else:

                        cnt += 1



print(cnt)
n=int(eval(input()))

s=eval(input())

ans=0

for i in range(10):

    if str(i) in s[:-2]:

        s1=s.index(str(i))



        for j in range(10):

            if str(j) in s[s1+1:-1]:

                s2=s[s1+1:].index(str(j))+s1+1



                for k in range(10):

                    if str(k) in s[s2+1:]:

                        ans+=1



print(ans)

n = int(eval(input()))
num_list = list(map(int, eval(input())))
cnt = 0
for i in range(10):
    if i not in num_list:
        continue
    else:
        first_pwd = num_list.index(i)
        new_num_list = num_list[first_pwd + 1 :]
        for j in range(10):
            if j not in new_num_list:
                continue
            else:
                second_pwd = new_num_list.index(j)
                new_new_num_list = new_num_list[second_pwd + 1 :]
                for k in range(10):
                    if k not in new_new_num_list:
                        continue
                    else:
                        cnt += 1
print(cnt)

n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(10):
    if str(i) in s[:-2]:
        s1 = s.index(str(i))
        for j in range(10):
            if str(j) in s[s1 + 1 : -1]:
                s2 = s[s1 + 1 :].index(str(j)) + s1 + 1
                for k in range(10):
                    if str(k) in s[s2 + 1 :]:
                        ans += 1
print(ans)

-num_list = list(map(int, eval(input()))) -cnt = 0 +s = eval(input()) +ans = 0 -    if i not in num_list: -        continue -    else: -        first_pwd = num_list.index(i) -        new_num_list = num_list[first_pwd + 1 :] +    if str(i) in s[:-2]: +        s1 = s.index(str(i)) -            if j not in new_num_list: -                continue -            else: -                second_pwd = new_num_list.index(j) -                new_new_num_list = new_num_list[second_pwd + 1 :] +            if str(j) in s[s1 + 1 : -1]: +                s2 = s[s1 + 1 :].index(str(j)) + s1 + 1 -                    if k not in new_new_num_list: -                        continue -                    else: -                        cnt += 1 -print(cnt) +                    if str(k) in s[s2 + 1 :]: +                        ans += 1 +print(ans)