

N = int(eval(input()))

S = eval(input())

ans = 0

anslst = []

for i in range(10):

    for j in range(10):

        for k in range(10):

            anslst.append(str(i) + str(j) + str(k))



tmp = ans

for i in anslst:

    a, b, c = i

    index1 = S.find(a)

    index2 = S.find(b, index1 + 1)

    index3 = S.find(c, index2 + 1)

    if index1 != -1 and index2 != -1 and index3 != -1:

        ans += 1

print(ans)


N = int(eval(input()))

S = eval(input())

cnt = 0

pin = []

for i in range(10):

    for j in range(10):

        for k in range(10):

            pin.append(str(i) + str(j) + str(k))



for i in range(1000):

    one = S.find(pin[i][0])

    two = S.find(pin[i][1], one + 1)

    three = S.find(pin[i][2], two + 1)

    if one != -1 and two != -1 and three != -1:

        cnt += 1



print(cnt)
N = int(eval(input()))
S = eval(input())
ans = 0
anslst = []
for i in range(10):
    for j in range(10):
        for k in range(10):
            anslst.append(str(i) + str(j) + str(k))
tmp = ans
for i in anslst:
    a, b, c = i
    index1 = S.find(a)
    index2 = S.find(b, index1 + 1)
    index3 = S.find(c, index2 + 1)
    if index1 != -1 and index2 != -1 and index3 != -1:
        ans += 1
print(ans)

N = int(eval(input()))
S = eval(input())
cnt = 0
pin = []
for i in range(10):
    for j in range(10):
        for k in range(10):
            pin.append(str(i) + str(j) + str(k))
for i in range(1000):
    one = S.find(pin[i][0])
    two = S.find(pin[i][1], one + 1)
    three = S.find(pin[i][2], two + 1)
    if one != -1 and two != -1 and three != -1:
        cnt += 1
print(cnt)

-ans = 0 -anslst = [] +cnt = 0 +pin = [] -            anslst.append(str(i) + str(j) + str(k)) -tmp = ans -for i in anslst: -    a, b, c = i -    index1 = S.find(a) -    index2 = S.find(b, index1 + 1) -    index3 = S.find(c, index2 + 1) -    if index1 != -1 and index2 != -1 and index3 != -1: -        ans += 1 -print(ans) +            pin.append(str(i) + str(j) + str(k)) +for i in range(1000): +    one = S.find(pin[i][0]) +    two = S.find(pin[i][1], one + 1) +    three = S.find(pin[i][2], two + 1) +    if one != -1 and two != -1 and three != -1: +        cnt += 1 +print(cnt)