N = int(eval(input()))

S = [int(i) for i in eval(input())]

ans = 0

for i in range(10):

    fp = -1

    for tf in range(N - 2):

        if S[tf] == i:

            fp = tf

            break

    if fp == -1:

        continue



    for j in range(10):

        sp = -1

        for ts in range(fp + 1, N - 1):

            if S[ts] == j:

                sp = ts

                break

        if sp == -1:

            continue



        for k in range(10):

            for tt in range(sp + 1, N):

                if S[tt] == k:



                    ans += 1

                    break



print(ans)











N = int(eval(input()))

S = eval(input())

ans = 0

for i in range(10):

    fp = S.find(str(i))

    if fp == -1:

        continue



    for j in range(10):

        sp = S.find(str(j), fp + 1)

        if sp == -1:

            continue



        for k in range(10):

            if str(k) in S[sp + 1:]:

                ans += 1



print(ans)











N = int(eval(input()))
S = [int(i) for i in eval(input())]
ans = 0
for i in range(10):
    fp = -1
    for tf in range(N - 2):
        if S[tf] == i:
            fp = tf
            break
    if fp == -1:
        continue
    for j in range(10):
        sp = -1
        for ts in range(fp + 1, N - 1):
            if S[ts] == j:
                sp = ts
                break
        if sp == -1:
            continue
        for k in range(10):
            for tt in range(sp + 1, N):
                if S[tt] == k:
                    ans += 1
                    break
print(ans)

N = int(eval(input()))
S = eval(input())
ans = 0
for i in range(10):
    fp = S.find(str(i))
    if fp == -1:
        continue
    for j in range(10):
        sp = S.find(str(j), fp + 1)
        if sp == -1:
            continue
        for k in range(10):
            if str(k) in S[sp + 1 :]:
                ans += 1
print(ans)

-S = [int(i) for i in eval(input())] +S = eval(input()) -    fp = -1 -    for tf in range(N - 2): -        if S[tf] == i: -            fp = tf -            break +    fp = S.find(str(i)) -        sp = -1 -        for ts in range(fp + 1, N - 1): -            if S[ts] == j: -                sp = ts -                break +        sp = S.find(str(j), fp + 1) -            for tt in range(sp + 1, N): -                if S[tt] == k: -                    ans += 1 -                    break +            if str(k) in S[sp + 1 :]: +                ans += 1