n = int(eval(input()))

s = eval(input())



done_1 = set()

done_2 = set()

done_3 = set()

for i in range(n):

    if s[i] in done_1:

        continue

    for j in range(i+1, n):

        if s[i] + s[j] in done_2:

            continue

        for k in range(j+1, n):

            pin = s[i] + s[j] + s[k]

            done_3.add(pin)

        done_2.add(pin[:2])

    done_1.add(pin[0])

print((len(done_3)))

n = int(eval(input()))

s = eval(input())



ans = 0

for i in range(1000):

    pin = str(i).zfill(3)

    p = s.find(pin[0])

    if p == -1 or p >= n - 1:

        continue

    q = s.find(pin[1], p+1)

    if q == -1 or q == n - 1:

        continue

    r = s.find(pin[2], q+1)

    if r == -1:

        continue

    ans += 1



print(ans)

n = int(eval(input()))
s = eval(input())
done_1 = set()
done_2 = set()
done_3 = set()
for i in range(n):
    if s[i] in done_1:
        continue
    for j in range(i + 1, n):
        if s[i] + s[j] in done_2:
            continue
        for k in range(j + 1, n):
            pin = s[i] + s[j] + s[k]
            done_3.add(pin)
        done_2.add(pin[:2])
    done_1.add(pin[0])
print((len(done_3)))

n = int(eval(input()))
s = eval(input())
ans = 0
for i in range(1000):
    pin = str(i).zfill(3)
    p = s.find(pin[0])
    if p == -1 or p >= n - 1:
        continue
    q = s.find(pin[1], p + 1)
    if q == -1 or q == n - 1:
        continue
    r = s.find(pin[2], q + 1)
    if r == -1:
        continue
    ans += 1
print(ans)

-done_1 = set() -done_2 = set() -done_3 = set() -for i in range(n): -    if s[i] in done_1: +ans = 0 +for i in range(1000): +    pin = str(i).zfill(3) +    p = s.find(pin[0]) +    if p == -1 or p >= n - 1: -    for j in range(i + 1, n): -        if s[i] + s[j] in done_2: -            continue -        for k in range(j + 1, n): -            pin = s[i] + s[j] + s[k] -            done_3.add(pin) -        done_2.add(pin[:2]) -    done_1.add(pin[0]) -print((len(done_3))) +    q = s.find(pin[1], p + 1) +    if q == -1 or q == n - 1: +        continue +    r = s.find(pin[2], q + 1) +    if r == -1: +        continue +    ans += 1 +print(ans)