from itertools import product



n = int(eval(input()))

s = eval(input())

ans = 0



for i in product(list(range(10)), repeat = 3):

    a = s.find(str(i[0]))

    if a != -1 and a != n - 1:

        b = s[a + 1:].find(str(i[1]))

        if b != -1:

            b += a + 1

            if b != n - 1:

                c = s[b + 1:].find(str(i[2]))

                if c != -1:

                    ans += 1

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

s = eval(input())

ans = 0



for i in range(1000):

    i = str(i).zfill(3)

    a = s.find(i[0])

    if a != -1:

        b = s.find(i[1], a + 1)

        if b != -1:

            c = s.find(i[2], b + 1)

            if c != -1:

                ans += 1

print(ans)
from itertools import product

n = int(eval(input()))
s = eval(input())
ans = 0
for i in product(list(range(10)), repeat=3):
    a = s.find(str(i[0]))
    if a != -1 and a != n - 1:
        b = s[a + 1 :].find(str(i[1]))
        if b != -1:
            b += a + 1
            if b != n - 1:
                c = s[b + 1 :].find(str(i[2]))
                if c != -1:
                    ans += 1
print(ans)

n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(1000):
    i = str(i).zfill(3)
    a = s.find(i[0])
    if a != -1:
        b = s.find(i[1], a + 1)
        if b != -1:
            c = s.find(i[2], b + 1)
            if c != -1:
                ans += 1
print(ans)

-from itertools import product - -for i in product(list(range(10)), repeat=3): -    a = s.find(str(i[0])) -    if a != -1 and a != n - 1: -        b = s[a + 1 :].find(str(i[1])) +for i in range(1000): +    i = str(i).zfill(3) +    a = s.find(i[0]) +    if a != -1: +        b = s.find(i[1], a + 1) -            b += a + 1 -            if b != n - 1: -                c = s[b + 1 :].find(str(i[2])) -                if c != -1: -                    ans += 1 +            c = s.find(i[2], b + 1) +            if c != -1: +                ans += 1