N = int(eval(input()))

S = eval(input())



ans = 0

for i in range(1000):

    num = str(i).zfill(3)

    flag2 = True

    start = 0

    for j in range(3):

        flag = False

        for k in range(start, N):

            if(num[j] == S[k]):

                flag = True

                start = k+1

                break

        if flag == False:

            flag2 = False

            break

    if flag2:

        ans += 1



print(ans)
def main():

    N = int(eval(input()))

    S = eval(input())

    

    cnt = 0

    for i in range(10):

        idx_i = S.find(str(i))

        if(idx_i == -1):

            continue

        for j in range(10):

            idx_j = S.find(str(j), idx_i+1)

            if(idx_j == -1):

                continue

            for k in range(10):

                idx_k = S.find(str(k), idx_j+1)

                if(idx_k == -1):

                    continue

                cnt += 1

    print(cnt)

main()
N = int(eval(input()))
S = eval(input())
ans = 0
for i in range(1000):
    num = str(i).zfill(3)
    flag2 = True
    start = 0
    for j in range(3):
        flag = False
        for k in range(start, N):
            if num[j] == S[k]:
                flag = True
                start = k + 1
                break
        if flag == False:
            flag2 = False
            break
    if flag2:
        ans += 1
print(ans)

def main():
    N = int(eval(input()))
    S = eval(input())
    cnt = 0
    for i in range(10):
        idx_i = S.find(str(i))
        if idx_i == -1:
            continue
        for j in range(10):
            idx_j = S.find(str(j), idx_i + 1)
            if idx_j == -1:
                continue
            for k in range(10):
                idx_k = S.find(str(k), idx_j + 1)
                if idx_k == -1:
                    continue
                cnt += 1
    print(cnt)


main()

-N = int(eval(input())) -S = eval(input()) -ans = 0 -for i in range(1000): -    num = str(i).zfill(3) -    flag2 = True -    start = 0 -    for j in range(3): -        flag = False -        for k in range(start, N): -            if num[j] == S[k]: -                flag = True -                start = k + 1 -                break -        if flag == False: -            flag2 = False -            break -    if flag2: -        ans += 1 -print(ans) +def main(): +    N = int(eval(input())) +    S = eval(input()) +    cnt = 0 +    for i in range(10): +        idx_i = S.find(str(i)) +        if idx_i == -1: +            continue +        for j in range(10): +            idx_j = S.find(str(j), idx_i + 1) +            if idx_j == -1: +                continue +            for k in range(10): +                idx_k = S.find(str(k), idx_j + 1) +                if idx_k == -1: +                    continue +                cnt += 1 +    print(cnt) + + +main()