N = int(eval(input()))

S = list(eval(input()))

ans = 0

for i in range(10):

    for j in range(10):

        for k in range(10):

            n = 0

            while str(i) != S[n] and n < N-3:

                n += 1

            if S[n] != str(i):

                break

            n += 1

            while str(j) != S[n] and n < N-2:

                n += 1

            if S[n] != str(j):

                break

            n += 1

            while str(k) != S[n] and n < N-1:

                n += 1

            if S[n] == str(k):

                ans += 1

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

S = eval(input())

ans = 0

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

for i in snumber:

    for j in snumber:

        for k in snumber:

            a = S.find(i)

            if a == -1:

                break

            b = S.find(j,a+1)

            if b == -1:

                break

            c = S.find(k,b+1)

            if c != -1:

                ans += 1

print(ans)

N = int(eval(input()))
S = list(eval(input()))
ans = 0
for i in range(10):
    for j in range(10):
        for k in range(10):
            n = 0
            while str(i) != S[n] and n < N - 3:
                n += 1
            if S[n] != str(i):
                break
            n += 1
            while str(j) != S[n] and n < N - 2:
                n += 1
            if S[n] != str(j):
                break
            n += 1
            while str(k) != S[n] and n < N - 1:
                n += 1
            if S[n] == str(k):
                ans += 1
print(ans)

N = int(eval(input()))
S = eval(input())
ans = 0
snumber = [str(i) for i in range(10)]
for i in snumber:
    for j in snumber:
        for k in snumber:
            a = S.find(i)
            if a == -1:
                break
            b = S.find(j, a + 1)
            if b == -1:
                break
            c = S.find(k, b + 1)
            if c != -1:
                ans += 1
print(ans)

-S = list(eval(input())) +S = eval(input()) -for i in range(10): -    for j in range(10): -        for k in range(10): -            n = 0 -            while str(i) != S[n] and n < N - 3: -                n += 1 -            if S[n] != str(i): +snumber = [str(i) for i in range(10)] +for i in snumber: +    for j in snumber: +        for k in snumber: +            a = S.find(i) +            if a == -1: -            n += 1 -            while str(j) != S[n] and n < N - 2: -                n += 1 -            if S[n] != str(j): +            b = S.find(j, a + 1) +            if b == -1: -            n += 1 -            while str(k) != S[n] and n < N - 1: -                n += 1 -            if S[n] == str(k): +            c = S.find(k, b + 1) +            if c != -1: