import re



N = int(eval(input()))

S = eval(input())



res = 0

fmt = "[0-9]*{}[0-9]*{}[0-9]*{}[0-9]*"

for i in range(10):

  idx_1 = S.find(str(i))

  if (idx_1 == -1) or (idx_1 > N-3):

    continue

  for j in range(10):

    idx_2 = S[idx_1+1:].find(str(j))

    if (idx_2 == -1) or (idx_2 > N-2):

      continue

    for k in range(10):

      idx_3 = S[idx_1+1+idx_2+1:].find(str(k))

      if idx_3 != -1:

        res += 1



print(res)

N = int(eval(input()))

S = eval(input())



res = 0

for i in range(10):

  idx_1 = S.find(str(i))

  if (idx_1 == -1) or (idx_1 > N-3):

    continue

  for j in range(10):

    idx_2 = S[idx_1+1:].find(str(j))

    if (idx_2 == -1) or (idx_2 > N-2):

      continue

    for k in range(10):

      idx_3 = S[idx_1+1+idx_2+1:].find(str(k))

      if idx_3 != -1:

        res += 1



print(res)

import re

N = int(eval(input()))
S = eval(input())
res = 0
fmt = "[0-9]*{}[0-9]*{}[0-9]*{}[0-9]*"
for i in range(10):
    idx_1 = S.find(str(i))
    if (idx_1 == -1) or (idx_1 > N - 3):
        continue
    for j in range(10):
        idx_2 = S[idx_1 + 1 :].find(str(j))
        if (idx_2 == -1) or (idx_2 > N - 2):
            continue
        for k in range(10):
            idx_3 = S[idx_1 + 1 + idx_2 + 1 :].find(str(k))
            if idx_3 != -1:
                res += 1
print(res)

N = int(eval(input()))
S = eval(input())
res = 0
for i in range(10):
    idx_1 = S.find(str(i))
    if (idx_1 == -1) or (idx_1 > N - 3):
        continue
    for j in range(10):
        idx_2 = S[idx_1 + 1 :].find(str(j))
        if (idx_2 == -1) or (idx_2 > N - 2):
            continue
        for k in range(10):
            idx_3 = S[idx_1 + 1 + idx_2 + 1 :].find(str(k))
            if idx_3 != -1:
                res += 1
print(res)

-import re - -fmt = "[0-9]*{}[0-9]*{}[0-9]*{}[0-9]*"