from pprint import pprint

import sys



n = int(sys.stdin.readline().strip())

s = sys.stdin.readline().strip()



count = 0

for i in range(1000):

    pin = str(i).zfill(3)

    start = 0

    flags = [False] * 3

    for i, pin_i in enumerate(pin):

        flag = False

        for j, s_j in enumerate(s):

            if j < start:

                continue

            if s_j == pin_i:

                flag = True

                start = j + 1

                break

        flags[i] = flag

    if flags[0] and flags[1] and flags[2]:

        # print(pin)

        count += 1



print(count)
import sys



N = int(sys.stdin.readline())

S = sys.stdin.readline()



ans = 0

for i in range(1000):

    password = str(i).zfill(3)

    p_i = 0

    s_i = 0

    while s_i < len(S) and p_i < 3:

        # print(p_i, s_i)

        if S[s_i] == password[p_i]:

            p_i += 1

        s_i += 1

    if p_i == 3:

        ans += 1

print(ans)
from pprint import pprint
import sys

n = int(sys.stdin.readline().strip())
s = sys.stdin.readline().strip()
count = 0
for i in range(1000):
    pin = str(i).zfill(3)
    start = 0
    flags = [False] * 3
    for i, pin_i in enumerate(pin):
        flag = False
        for j, s_j in enumerate(s):
            if j < start:
                continue
            if s_j == pin_i:
                flag = True
                start = j + 1
                break
        flags[i] = flag
    if flags[0] and flags[1] and flags[2]:
        # print(pin)
        count += 1
print(count)

import sys

N = int(sys.stdin.readline())
S = sys.stdin.readline()
ans = 0
for i in range(1000):
    password = str(i).zfill(3)
    p_i = 0
    s_i = 0
    while s_i < len(S) and p_i < 3:
        # print(p_i, s_i)
        if S[s_i] == password[p_i]:
            p_i += 1
        s_i += 1
    if p_i == 3:
        ans += 1
print(ans)

-from pprint import pprint -n = int(sys.stdin.readline().strip()) -s = sys.stdin.readline().strip() -count = 0 +N = int(sys.stdin.readline()) +S = sys.stdin.readline() +ans = 0 -    pin = str(i).zfill(3) -    start = 0 -    flags = [False] * 3 -    for i, pin_i in enumerate(pin): -        flag = False -        for j, s_j in enumerate(s): -            if j < start: -                continue -            if s_j == pin_i: -                flag = True -                start = j + 1 -                break -        flags[i] = flag -    if flags[0] and flags[1] and flags[2]: -        # print(pin) -        count += 1 -print(count) +    password = str(i).zfill(3) +    p_i = 0 +    s_i = 0 +    while s_i < len(S) and p_i < 3: +        # print(p_i, s_i) +        if S[s_i] == password[p_i]: +            p_i += 1 +        s_i += 1 +    if p_i == 3: +        ans += 1 +print(ans)