N = int(eval(input()))

S = input().strip()

cnt = 0

for i in range(10):

    for j in range(10):

        for k in range(10):

            flag = 0

            for n in range(N):

                if flag==0 and S[n]==str(i):

                    flag = 1

                elif flag==1 and S[n]==str(j):

                    flag = 2

                elif flag==2 and S[n]==str(k):

                    flag = 3

                    break

            if flag==3:

                cnt += 1

print(cnt)
def chk(x):

    cur = 0

    cnt = 0

    while cur<N:

        if S[cur]==str(x[cnt]):

            cnt += 1

            if cnt==3:

                break

        cur += 1

    if cnt==3:

        return 1

    else:

        return 0



N = int(eval(input()))

S = input().strip()

cnt = 0

for i in range(0,10):

    for j in range(0,10):

        for k in range(0,10):

            cnt += chk((i,j,k))

print(cnt)
N = int(eval(input()))
S = input().strip()
cnt = 0
for i in range(10):
    for j in range(10):
        for k in range(10):
            flag = 0
            for n in range(N):
                if flag == 0 and S[n] == str(i):
                    flag = 1
                elif flag == 1 and S[n] == str(j):
                    flag = 2
                elif flag == 2 and S[n] == str(k):
                    flag = 3
                    break
            if flag == 3:
                cnt += 1
print(cnt)

def chk(x):
    cur = 0
    cnt = 0
    while cur < N:
        if S[cur] == str(x[cnt]):
            cnt += 1
            if cnt == 3:
                break
        cur += 1
    if cnt == 3:
        return 1
    else:
        return 0


N = int(eval(input()))
S = input().strip()
cnt = 0
for i in range(0, 10):
    for j in range(0, 10):
        for k in range(0, 10):
            cnt += chk((i, j, k))
print(cnt)

+def chk(x): +    cur = 0 +    cnt = 0 +    while cur < N: +        if S[cur] == str(x[cnt]): +            cnt += 1 +            if cnt == 3: +                break +        cur += 1 +    if cnt == 3: +        return 1 +    else: +        return 0 + + -for i in range(10): -    for j in range(10): -        for k in range(10): -            flag = 0 -            for n in range(N): -                if flag == 0 and S[n] == str(i): -                    flag = 1 -                elif flag == 1 and S[n] == str(j): -                    flag = 2 -                elif flag == 2 and S[n] == str(k): -                    flag = 3 -                    break -            if flag == 3: -                cnt += 1 +for i in range(0, 10): +    for j in range(0, 10): +        for k in range(0, 10): +            cnt += chk((i, j, k))