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 = [x for x, y in enumerate(s) if x > a and y == j][0]

                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 = 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 = 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 = [x for x, y in enumerate(s) if x > a and y == j][0]
                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 = 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)))

-                b = [x for x, y in enumerate(s) if x > a and y == j][0] +                b = a + s[a + 1 :].index(j) + 1