from collections import defaultdict

n = int(eval(input()))

S = list(eval(input()))



d = [defaultdict(int) for i in range(3)]

for s in S:

    for x in d[1]:

        d[2][x+s]+=1

    for x in d[0]:

        d[1][x+s]+=1

    d[0][s]+=1

print((len(d[2])))
n = int(eval(input()))

S = eval(input())

ans = 0

for i in range(10):

    a = S.find(str(i))

    if a != -1:

        for j in range(10):

            b = S[a+1:].find(str(j))

            if b != -1:

                for k in range(10):

                    c = S[a+1:][b+1:].find(str(k))

                    if c!=-1:

                        ans+=1

                        #print(i,j,k,a,b,c)



print(ans)
from collections import defaultdict

n = int(eval(input()))
S = list(eval(input()))
d = [defaultdict(int) for i in range(3)]
for s in S:
    for x in d[1]:
        d[2][x + s] += 1
    for x in d[0]:
        d[1][x + s] += 1
    d[0][s] += 1
print((len(d[2])))

n = int(eval(input()))
S = eval(input())
ans = 0
for i in range(10):
    a = S.find(str(i))
    if a != -1:
        for j in range(10):
            b = S[a + 1 :].find(str(j))
            if b != -1:
                for k in range(10):
                    c = S[a + 1 :][b + 1 :].find(str(k))
                    if c != -1:
                        ans += 1
                        # print(i,j,k,a,b,c)
print(ans)

-from collections import defaultdict - -S = list(eval(input())) -d = [defaultdict(int) for i in range(3)] -for s in S: -    for x in d[1]: -        d[2][x + s] += 1 -    for x in d[0]: -        d[1][x + s] += 1 -    d[0][s] += 1 -print((len(d[2]))) +S = eval(input()) +ans = 0 +for i in range(10): +    a = S.find(str(i)) +    if a != -1: +        for j in range(10): +            b = S[a + 1 :].find(str(j)) +            if b != -1: +                for k in range(10): +                    c = S[a + 1 :][b + 1 :].find(str(k)) +                    if c != -1: +                        ans += 1 +                        # print(i,j,k,a,b,c) +print(ans)