n = int(eval(input()))

s = list(map(int, list(eval(input()))))

idx = [[] for _ in range(10)]

for i, v in enumerate(s):

    idx[v].append(i)



ans = 0

for i in range(1000):

    c = 0

    p = -1

    chk = True

    while c < 3 and chk:

        chk = False

        for j in idx[i // 100]:

            if j > p:

                c += 1

                p = j

                chk = True

                i = i % 100 * 10

                break

    if c == 3:

        ans += 1

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

s = eval(input())



def chk_substr(s, t):

    p = -1

    for i in t:

        p = s.find(i, p + 1)

        if p == -1:

            return False

    return True



ans = 0

for i in range(1000):

    t = str(i).zfill(3)

    if chk_substr(s, t):

        ans += 1

print(ans)
n = int(eval(input()))
s = list(map(int, list(eval(input()))))
idx = [[] for _ in range(10)]
for i, v in enumerate(s):
    idx[v].append(i)
ans = 0
for i in range(1000):
    c = 0
    p = -1
    chk = True
    while c < 3 and chk:
        chk = False
        for j in idx[i // 100]:
            if j > p:
                c += 1
                p = j
                chk = True
                i = i % 100 * 10
                break
    if c == 3:
        ans += 1
print(ans)

n = int(eval(input()))
s = eval(input())


def chk_substr(s, t):
    p = -1
    for i in t:
        p = s.find(i, p + 1)
        if p == -1:
            return False
    return True


ans = 0
for i in range(1000):
    t = str(i).zfill(3)
    if chk_substr(s, t):
        ans += 1
print(ans)

-s = list(map(int, list(eval(input())))) -idx = [[] for _ in range(10)] -for i, v in enumerate(s): -    idx[v].append(i) +s = eval(input()) + + +def chk_substr(s, t): +    p = -1 +    for i in t: +        p = s.find(i, p + 1) +        if p == -1: +            return False +    return True + + -    c = 0 -    p = -1 -    chk = True -    while c < 3 and chk: -        chk = False -        for j in idx[i // 100]: -            if j > p: -                c += 1 -                p = j -                chk = True -                i = i % 100 * 10 -                break -    if c == 3: +    t = str(i).zfill(3) +    if chk_substr(s, t):