N = int(eval(input()))

S = eval(input())

ans = 0

for x in range(10):

    for y in range(10):

        for z in range(10):

            for i in range(N):

                if x != int(S[i]):

                    continue

                for j in range(i+1, N):

                    if y != int(S[j]):

                        continue

                    for k in range(j+1, N):

                        if z != int(S[k]):

                            continue

                        ans += z == int(S[k])

                        break

                    break

                break

print(ans)

from collections import Counter

N = int(eval(input()))

S = eval(input())

ans = 0

for x in range(10):

    for y in range(10):

        hantei = []

        for i in range(N):

            if x != int(S[i]):

                continue

            for j in range(i+1, N):

                if y != int(S[j]):

                    continue

                for k in range(j+1, N):

                    hantei.append(S[k])

                ans += len(Counter(hantei))

                break

            break



print(ans)

N = int(eval(input()))
S = eval(input())
ans = 0
for x in range(10):
    for y in range(10):
        for z in range(10):
            for i in range(N):
                if x != int(S[i]):
                    continue
                for j in range(i + 1, N):
                    if y != int(S[j]):
                        continue
                    for k in range(j + 1, N):
                        if z != int(S[k]):
                            continue
                        ans += z == int(S[k])
                        break
                    break
                break
print(ans)

from collections import Counter

N = int(eval(input()))
S = eval(input())
ans = 0
for x in range(10):
    for y in range(10):
        hantei = []
        for i in range(N):
            if x != int(S[i]):
                continue
            for j in range(i + 1, N):
                if y != int(S[j]):
                    continue
                for k in range(j + 1, N):
                    hantei.append(S[k])
                ans += len(Counter(hantei))
                break
            break
print(ans)

+from collections import Counter + -        for z in range(10): -            for i in range(N): -                if x != int(S[i]): +        hantei = [] +        for i in range(N): +            if x != int(S[i]): +                continue +            for j in range(i + 1, N): +                if y != int(S[j]): -                for j in range(i + 1, N): -                    if y != int(S[j]): -                        continue -                    for k in range(j + 1, N): -                        if z != int(S[k]): -                            continue -                        ans += z == int(S[k]) -                        break -                    break +                for k in range(j + 1, N): +                    hantei.append(S[k]) +                ans += len(Counter(hantei)) +            break