N = int(eval(input()))

S = list(eval(input()))

S = [int(s) for s in S]



left = [[0]*10 for _ in range(N)]

right = [[0]*10 for _ in range(N+1)]



ans = [0]*1000 #ans[000]~[999]=Bool



for i,s in enumerate(S):

  for j in range(10):

    left[i][j] = left[i-1][j]

  left[i][s] = 1

  

for i,s in enumerate(S[::-1]):

  for j in range(10):

    right[N-i-1][j] = right[N-i][j]

  right[N-i-1][s] = 1

  

for i,s in enumerate(S):

  if 0<i<N-1:

    for l in range(10):

      for r in range(10):

        if left[i-1][l] and right[i+1][r]:

          #print(100*l+10*s+r)

          ans[100*l+10*s+r]=1

          

print((sum(ans)))
N = int(eval(input()))

S = eval(input())



from itertools import product



p = product([str(i) for i in range(10)], repeat=3)



ans = 0

for i,j,k in p:

  x = S.find(i)

  if x<0:

    continue

  y = S[x+1:].find(j)

  if y<0:

    continue

  z = S[x+y+2:].find(k)

  if z<0:

    continue

  #print(i,j,k, S, S[x+1:],S[x+y+2:])

  ans += 1

print(ans)

    
N = int(eval(input()))
S = list(eval(input()))
S = [int(s) for s in S]
left = [[0] * 10 for _ in range(N)]
right = [[0] * 10 for _ in range(N + 1)]
ans = [0] * 1000  # ans[000]~[999]=Bool
for i, s in enumerate(S):
    for j in range(10):
        left[i][j] = left[i - 1][j]
    left[i][s] = 1
for i, s in enumerate(S[::-1]):
    for j in range(10):
        right[N - i - 1][j] = right[N - i][j]
    right[N - i - 1][s] = 1
for i, s in enumerate(S):
    if 0 < i < N - 1:
        for l in range(10):
            for r in range(10):
                if left[i - 1][l] and right[i + 1][r]:
                    # print(100*l+10*s+r)
                    ans[100 * l + 10 * s + r] = 1
print((sum(ans)))

N = int(eval(input()))
S = eval(input())
from itertools import product

p = product([str(i) for i in range(10)], repeat=3)
ans = 0
for i, j, k in p:
    x = S.find(i)
    if x < 0:
        continue
    y = S[x + 1 :].find(j)
    if y < 0:
        continue
    z = S[x + y + 2 :].find(k)
    if z < 0:
        continue
    # print(i,j,k, S, S[x+1:],S[x+y+2:])
    ans += 1
print(ans)

-S = list(eval(input())) -S = [int(s) for s in S] -left = [[0] * 10 for _ in range(N)] -right = [[0] * 10 for _ in range(N + 1)] -ans = [0] * 1000  # ans[000]~[999]=Bool -for i, s in enumerate(S): -    for j in range(10): -        left[i][j] = left[i - 1][j] -    left[i][s] = 1 -for i, s in enumerate(S[::-1]): -    for j in range(10): -        right[N - i - 1][j] = right[N - i][j] -    right[N - i - 1][s] = 1 -for i, s in enumerate(S): -    if 0 < i < N - 1: -        for l in range(10): -            for r in range(10): -                if left[i - 1][l] and right[i + 1][r]: -                    # print(100*l+10*s+r) -                    ans[100 * l + 10 * s + r] = 1 -print((sum(ans))) +S = eval(input()) +from itertools import product + +p = product([str(i) for i in range(10)], repeat=3) +ans = 0 +for i, j, k in p: +    x = S.find(i) +    if x < 0: +        continue +    y = S[x + 1 :].find(j) +    if y < 0: +        continue +    z = S[x + y + 2 :].find(k) +    if z < 0: +        continue +    # print(i,j,k, S, S[x+1:],S[x+y+2:]) +    ans += 1 +print(ans)