from itertools import product



n = int(eval(input()))

s = eval(input())



nums = [str(i) for i in range(10)]



ans = 0

for pat in product(nums, repeat=3):

    i = 0

    for e in s:

        if e == pat[i]:

            i += 1



        if i == 3:

            break



    if i == 3:

        ans += 1



print(ans)

n = int(eval(input()))

s = eval(input())



nums = tuple(str(i) for i in range(10))



ans = 0

for i in nums:

    pi = s.find(i)

    if pi == -1:

        continue



    for j in nums:

        pj = s.find(j, pi + 1)

        if pj == -1:

            continue



        for k in nums:

            pk = s.find(k, pj + 1)

            if pk == -1:

                continue



            ans += 1



print(ans)

from itertools import product

n = int(eval(input()))
s = eval(input())
nums = [str(i) for i in range(10)]
ans = 0
for pat in product(nums, repeat=3):
    i = 0
    for e in s:
        if e == pat[i]:
            i += 1
        if i == 3:
            break
    if i == 3:
        ans += 1
print(ans)

n = int(eval(input()))
s = eval(input())
nums = tuple(str(i) for i in range(10))
ans = 0
for i in nums:
    pi = s.find(i)
    if pi == -1:
        continue
    for j in nums:
        pj = s.find(j, pi + 1)
        if pj == -1:
            continue
        for k in nums:
            pk = s.find(k, pj + 1)
            if pk == -1:
                continue
            ans += 1
print(ans)

-from itertools import product - -nums = [str(i) for i in range(10)] +nums = tuple(str(i) for i in range(10)) -for pat in product(nums, repeat=3): -    i = 0 -    for e in s: -        if e == pat[i]: -            i += 1 -        if i == 3: -            break -    if i == 3: -        ans += 1 +for i in nums: +    pi = s.find(i) +    if pi == -1: +        continue +    for j in nums: +        pj = s.find(j, pi + 1) +        if pj == -1: +            continue +        for k in nums: +            pk = s.find(k, pj + 1) +            if pk == -1: +                continue +            ans += 1