N = int(eval(input()))

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



ans = 0



for i in range(10):

  for j in range(10):

    for k in range(10):

      Flag1 = True

      Flag2 = False

      Flag3 = False

      for x in S:

        if Flag3:

          if x == k:

            ans += 1

            break

        if Flag2:

          if x == j:

            Flag2 = False

            Flag3 = True

        if Flag1:

          if x == i:

            Flag1 = False

            Flag2 = True



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

S = eval(input())



ans = 0



for i in range(10):

  a = S.find(str(i))

  if a == -1:

    continue

  for j in range(10):

    b = S.find(str(j), a+1)

    if b == -1:

      continue

    for k in range(10):

      c = S.find(str(k), b+1)

      if c != -1:

        ans += 1



print(ans)
N = int(eval(input()))
S = [int(i) for i in eval(input())]
ans = 0
for i in range(10):
    for j in range(10):
        for k in range(10):
            Flag1 = True
            Flag2 = False
            Flag3 = False
            for x in S:
                if Flag3:
                    if x == k:
                        ans += 1
                        break
                if Flag2:
                    if x == j:
                        Flag2 = False
                        Flag3 = True
                if Flag1:
                    if x == i:
                        Flag1 = False
                        Flag2 = True
print(ans)

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

-S = [int(i) for i in eval(input())] +S = eval(input()) +    a = S.find(str(i)) +    if a == -1: +        continue +        b = S.find(str(j), a + 1) +        if b == -1: +            continue -            Flag1 = True -            Flag2 = False -            Flag3 = False -            for x in S: -                if Flag3: -                    if x == k: -                        ans += 1 -                        break -                if Flag2: -                    if x == j: -                        Flag2 = False -                        Flag3 = True -                if Flag1: -                    if x == i: -                        Flag1 = False -                        Flag2 = True +            c = S.find(str(k), b + 1) +            if c != -1: +                ans += 1