import bisect

n = int(eval(input()))

s = eval(input())

count = 0

num_ind_list = []

for i in range(10):

    num_ind_list.append([0])

for i in range(n):

    num_ind_list[int(s[i])].append(i)

for i in range(10):

    num_ind_list[i].append(30000)

for i in range(10):

    if len(num_ind_list[i]) != 2:

        for j in range(10):

            b = bisect.bisect_right(num_ind_list[j], num_ind_list[i][1])

            if num_ind_list[j][b] != 30000:

                for k in range(10):

                    c = bisect.bisect_right(num_ind_list[k], num_ind_list[j][b])

                    if num_ind_list[k][c] != 30000: count += 1

print(count)

n = int(eval(input()))

s = eval(input())

num_list = [str(i).zfill(3) for i in range(1000)]

ans = 0

for i in range(1000):

    i100 = num_list[i][0]

    i10 = num_list[i][1]

    i1 = num_list[i][2]

    count = 0

    a = s.find(i100)

    if a != -1:

        count += 1

        a += 1

    b = s.find(i10, a)

    if b != -1:

        count += 1

        b += 1

    c = s.find(i1, b)

    if c != -1:

        count += 1

    if count == 3:

        ans += 1

print(ans)

import bisect

n = int(eval(input()))
s = eval(input())
count = 0
num_ind_list = []
for i in range(10):
    num_ind_list.append([0])
for i in range(n):
    num_ind_list[int(s[i])].append(i)
for i in range(10):
    num_ind_list[i].append(30000)
for i in range(10):
    if len(num_ind_list[i]) != 2:
        for j in range(10):
            b = bisect.bisect_right(num_ind_list[j], num_ind_list[i][1])
            if num_ind_list[j][b] != 30000:
                for k in range(10):
                    c = bisect.bisect_right(num_ind_list[k], num_ind_list[j][b])
                    if num_ind_list[k][c] != 30000:
                        count += 1
print(count)

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

-import bisect - -count = 0 -num_ind_list = [] -for i in range(10): -    num_ind_list.append([0]) -for i in range(n): -    num_ind_list[int(s[i])].append(i) -for i in range(10): -    num_ind_list[i].append(30000) -for i in range(10): -    if len(num_ind_list[i]) != 2: -        for j in range(10): -            b = bisect.bisect_right(num_ind_list[j], num_ind_list[i][1]) -            if num_ind_list[j][b] != 30000: -                for k in range(10): -                    c = bisect.bisect_right(num_ind_list[k], num_ind_list[j][b]) -                    if num_ind_list[k][c] != 30000: -                        count += 1 -print(count) +num_list = [str(i).zfill(3) for i in range(1000)] +ans = 0 +for i in range(1000): +    i100 = num_list[i][0] +    i10 = num_list[i][1] +    i1 = num_list[i][2] +    count = 0 +    a = s.find(i100) +    if a != -1: +        count += 1 +        a += 1 +    b = s.find(i10, a) +    if b != -1: +        count += 1 +        b += 1 +    c = s.find(i1, b) +    if c != -1: +        count += 1 +    if count == 3: +        ans += 1 +print(ans)