N = eval(input())

S = eval(input())

count = 0

for i in range(1000):

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

    n1, n2, n3 = n[0], n[1], n[2]

    i1 = S.find(n1)

    if -1 < i1 < len(S) - 2:

        S1 = S[i1 + 1:]

        i2 = S1.find(n2)

        if -1 < i2 < len(S1) - 1:

            S2 = S1[i2 + 1:]

            i3 = S2.find(n3)

            if -1 < i3:

                count += 1

                continue

print(count)

N = eval(input())

S = eval(input())

count = 0

for i in range(1000):

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

    n1, n2, n3 = n[0], n[1], n[2]

    i1 = S.find(n1)

    if -1 < i1 < len(S) - 2:

        i2 = S.find(n2, i1 + 1)

        if -1 < i2 < len(S) - 1:

            i3 = S.find(n3, i2 + 1)

            if -1 < i3:

                count += 1

                continue

print(count)

N = eval(input())
S = eval(input())
count = 0
for i in range(1000):
    n = "{:03d}".format(i)
    n1, n2, n3 = n[0], n[1], n[2]
    i1 = S.find(n1)
    if -1 < i1 < len(S) - 2:
        S1 = S[i1 + 1 :]
        i2 = S1.find(n2)
        if -1 < i2 < len(S1) - 1:
            S2 = S1[i2 + 1 :]
            i3 = S2.find(n3)
            if -1 < i3:
                count += 1
                continue
print(count)

N = eval(input())
S = eval(input())
count = 0
for i in range(1000):
    n = "{:03d}".format(i)
    n1, n2, n3 = n[0], n[1], n[2]
    i1 = S.find(n1)
    if -1 < i1 < len(S) - 2:
        i2 = S.find(n2, i1 + 1)
        if -1 < i2 < len(S) - 1:
            i3 = S.find(n3, i2 + 1)
            if -1 < i3:
                count += 1
                continue
print(count)

-        S1 = S[i1 + 1 :] -        i2 = S1.find(n2) -        if -1 < i2 < len(S1) - 1: -            S2 = S1[i2 + 1 :] -            i3 = S2.find(n3) +        i2 = S.find(n2, i1 + 1) +        if -1 < i2 < len(S) - 1: +            i3 = S.find(n3, i2 + 1)