n = int(eval(input()))

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



ans = []



for i in range(10):

    if i in s:

        a = s.index(i)

        for j in range(10):

            if j in s[a + 1 :]:

                b = a + s[a + 1 :].index(j) + 1

                for k in range(10):

                    if k in s[b + 1 :]:

                        ans.append(f"{i}{j}{k}")

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

s = eval(input())



ans = 0



for i in range(10):

    a = s.find(str(i))

    if a == -1:

        continue

    for j in range(10):

        b = s.find(str(j), a + 1)

        if b == -1:

            continue

        for k in range(10):

            c = s.find(str(k), b + 1)

            if c == -1:

                continue

            ans += 1

print(ans)
n = int(eval(input()))
s = list(map(int, eval(input())))
ans = []
for i in range(10):
    if i in s:
        a = s.index(i)
        for j in range(10):
            if j in s[a + 1 :]:
                b = a + s[a + 1 :].index(j) + 1
                for k in range(10):
                    if k in s[b + 1 :]:
                        ans.append(f"{i}{j}{k}")
print((len(ans)))

n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(10):
    a = s.find(str(i))
    if a == -1:
        continue
    for j in range(10):
        b = s.find(str(j), a + 1)
        if b == -1:
            continue
        for k in range(10):
            c = s.find(str(k), b + 1)
            if c == -1:
                continue
            ans += 1
print(ans)

-s = list(map(int, eval(input()))) -ans = [] +s = eval(input()) +ans = 0 -    if i in s: -        a = s.index(i) -        for j in range(10): -            if j in s[a + 1 :]: -                b = a + s[a + 1 :].index(j) + 1 -                for k in range(10): -                    if k in s[b + 1 :]: -                        ans.append(f"{i}{j}{k}") -print((len(ans))) +    a = s.find(str(i)) +    if a == -1: +        continue +    for j in range(10): +        b = s.find(str(j), a + 1) +        if b == -1: +            continue +        for k in range(10): +            c = s.find(str(k), b + 1) +            if c == -1: +                continue +            ans += 1 +print(ans)