# D - Lucky PIN

N = int(eval(input()))

S = eval(input())



ans = 0

for i in range(10):

    for j in range(10):

        for k in range(10):

            a = S.find(str(i))

            if a == -1:

                continue

            # i が含まれるとき

            b = S.find(str(j),a+1)

            if not(a < b):

                continue

            # j の index が a以降のとき

            c = S.find(str(k),b+1)

            if not(b < c):

                continue

            # k の index が b　以降のとき

            ans += 1

print(ans)
# D - Lucky PIN

N = int(eval(input()))

S = eval(input())



cnt = 0

for i in range(10):

    for j in range(10):

        for k in range(10):

            a = S.find(str(i))

            if a == -1:

                continue

            b = S.find(str(j),a+1)

            if b == -1:

                continue

            c = S.find(str(k),b+1)

            if c == -1:

                continue

            cnt += 1

print(cnt)
# D - Lucky PIN
N = int(eval(input()))
S = eval(input())
ans = 0
for i in range(10):
    for j in range(10):
        for k in range(10):
            a = S.find(str(i))
            if a == -1:
                continue
            # i が含まれるとき
            b = S.find(str(j), a + 1)
            if not (a < b):
                continue
            # j の index が a以降のとき
            c = S.find(str(k), b + 1)
            if not (b < c):
                continue
            # k の index が b　以降のとき
            ans += 1
print(ans)

# D - Lucky PIN
N = int(eval(input()))
S = eval(input())
cnt = 0
for i in range(10):
    for j in range(10):
        for k in range(10):
            a = S.find(str(i))
            if a == -1:
                continue
            b = S.find(str(j), a + 1)
            if b == -1:
                continue
            c = S.find(str(k), b + 1)
            if c == -1:
                continue
            cnt += 1
print(cnt)

-ans = 0 +cnt = 0 -            # i が含まれるとき -            if not (a < b): +            if b == -1: -            # j の index が a以降のとき -            if not (b < c): +            if c == -1: -            # k の index が b　以降のとき -            ans += 1 -print(ans) +            cnt += 1 +print(cnt)