from itertools import combinations



N = int(eval(input()))

S = eval(input())

count = 0



ans = set({})



for password in range(0, 1000):

    s = "{:03d}".format(password)

    s1, s2, s3 = s

    

    if s1 not in S:

        continue

    i1 = S.index(s1)

    if s2 not in S[i1+1:]:

        continue

    i2 = S[i1+1:].index(s2)

    if s3 not in S[i1+1:][i2+1:]:

        continue

    i3 = S[i1+1:][i2+1:].index(s3)

    # print(s, s1, s2, s3, "|", i1, i1 + i2, i1 + i2 + i3)

    ans.add(password)



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

S = eval(input())



# 3桁の数値の総当り

count = 0

for n in range(0, 1000):

    password = "{:03d}".format(n)

    p1, p2, p3 = password



    i1 = S.find(str(p1))

    if i1 < 0:

        continue

    i2 = S[i1+1:].find(str(p2))

    if i2 < 0:

        continue

    i3 = S[i1+1:][i2+1:].find(str(p3))

    if i3 < 0:

        continue

    count += 1

print(count)
from itertools import combinations

N = int(eval(input()))
S = eval(input())
count = 0
ans = set({})
for password in range(0, 1000):
    s = "{:03d}".format(password)
    s1, s2, s3 = s
    if s1 not in S:
        continue
    i1 = S.index(s1)
    if s2 not in S[i1 + 1 :]:
        continue
    i2 = S[i1 + 1 :].index(s2)
    if s3 not in S[i1 + 1 :][i2 + 1 :]:
        continue
    i3 = S[i1 + 1 :][i2 + 1 :].index(s3)
    # print(s, s1, s2, s3, "|", i1, i1 + i2, i1 + i2 + i3)
    ans.add(password)
print((len(ans)))

N = int(eval(input()))
S = eval(input())
# 3桁の数値の総当り
count = 0
for n in range(0, 1000):
    password = "{:03d}".format(n)
    p1, p2, p3 = password
    i1 = S.find(str(p1))
    if i1 < 0:
        continue
    i2 = S[i1 + 1 :].find(str(p2))
    if i2 < 0:
        continue
    i3 = S[i1 + 1 :][i2 + 1 :].find(str(p3))
    if i3 < 0:
        continue
    count += 1
print(count)

-from itertools import combinations - +# 3桁の数値の総当り -ans = set({}) -for password in range(0, 1000): -    s = "{:03d}".format(password) -    s1, s2, s3 = s -    if s1 not in S: +for n in range(0, 1000): +    password = "{:03d}".format(n) +    p1, p2, p3 = password +    i1 = S.find(str(p1)) +    if i1 < 0: -    i1 = S.index(s1) -    if s2 not in S[i1 + 1 :]: +    i2 = S[i1 + 1 :].find(str(p2)) +    if i2 < 0: -    i2 = S[i1 + 1 :].index(s2) -    if s3 not in S[i1 + 1 :][i2 + 1 :]: +    i3 = S[i1 + 1 :][i2 + 1 :].find(str(p3)) +    if i3 < 0: -    i3 = S[i1 + 1 :][i2 + 1 :].index(s3) -    # print(s, s1, s2, s3, "|", i1, i1 + i2, i1 + i2 + i3) -    ans.add(password) -print((len(ans))) +    count += 1 +print(count)