import collections



N = int(eval(input()))

S = [int(i) for i in list(eval(input()))]



count = 0

for i in range(10):

    for num,j in enumerate(S):

        if j == i:

            T = S[num+1::]

            for k in list(set(T)):

                for num2, l in enumerate(T):

                    if k == l:

                        U = T[num2+1::]

                        count += len(set(U))

                        break

            

            break

            

print(count)

                
N = int(eval(input()))

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



cnt = 0

for i in range(10):

    if i in S:

        k = S.index(i)

        for j in range(10):

            if j in S[k+1:]:

                l = S[k+1:].index(j)

                cnt += len(set(S[k+l+2:]))



print(cnt)

import collections

N = int(eval(input()))
S = [int(i) for i in list(eval(input()))]
count = 0
for i in range(10):
    for num, j in enumerate(S):
        if j == i:
            T = S[num + 1 : :]
            for k in list(set(T)):
                for num2, l in enumerate(T):
                    if k == l:
                        U = T[num2 + 1 : :]
                        count += len(set(U))
                        break
            break
print(count)

N = int(eval(input()))
S = list(map(int, eval(input())))
cnt = 0
for i in range(10):
    if i in S:
        k = S.index(i)
        for j in range(10):
            if j in S[k + 1 :]:
                l = S[k + 1 :].index(j)
                cnt += len(set(S[k + l + 2 :]))
print(cnt)

-import collections - -S = [int(i) for i in list(eval(input()))] -count = 0 +S = list(map(int, eval(input()))) +cnt = 0 -    for num, j in enumerate(S): -        if j == i: -            T = S[num + 1 : :] -            for k in list(set(T)): -                for num2, l in enumerate(T): -                    if k == l: -                        U = T[num2 + 1 : :] -                        count += len(set(U)) -                        break -            break -print(count) +    if i in S: +        k = S.index(i) +        for j in range(10): +            if j in S[k + 1 :]: +                l = S[k + 1 :].index(j) +                cnt += len(set(S[k + l + 2 :])) +print(cnt)