import sys

input = sys.stdin.buffer.readline



N = int(eval(input()))

S = eval(input())

ans = 0

for i in range(0, 1000):

    k = str(i).zfill(3)

    dic = {0: False, 1: False, 2: False}

    for t in str(S):

        if dic[0] is False:

            if t == k[0]:

                dic[0] = True

        else:

            if dic[1] is False:

                if t == k[1]:

                    dic[1] = True

            else:

                if dic[2] is False:

                    if t == k[2]:

                        dic[2] = True

                        ans += 1

                        break

                else:

                    ans += 1

                    break



print(ans)

import sys

input = sys.stdin.buffer.readline





def canMakeNumber(k, s):

    k = str(k).zfill(3)

    dic = {0: False, 1: False, 2: False}

    for t in s:

        if dic[0] is False:

            if t == k[0]:

                dic[0] = True

        else:

            if dic[1] is False:

                if t == k[1]:

                    dic[1] = True

            else:

                if dic[2] is False:

                    if t == k[2]:

                        dic[2] = True

                        return True

                else:

                    return True

    return False





N = int(eval(input()))

S = eval(input())

ans = 0

for i in range(0, 1000):

    if canMakeNumber(i, str(S)):

        ans += 1

print(ans)

import sys

input = sys.stdin.buffer.readline
N = int(eval(input()))
S = eval(input())
ans = 0
for i in range(0, 1000):
    k = str(i).zfill(3)
    dic = {0: False, 1: False, 2: False}
    for t in str(S):
        if dic[0] is False:
            if t == k[0]:
                dic[0] = True
        else:
            if dic[1] is False:
                if t == k[1]:
                    dic[1] = True
            else:
                if dic[2] is False:
                    if t == k[2]:
                        dic[2] = True
                        ans += 1
                        break
                else:
                    ans += 1
                    break
print(ans)

import sys

input = sys.stdin.buffer.readline


def canMakeNumber(k, s):
    k = str(k).zfill(3)
    dic = {0: False, 1: False, 2: False}
    for t in s:
        if dic[0] is False:
            if t == k[0]:
                dic[0] = True
        else:
            if dic[1] is False:
                if t == k[1]:
                    dic[1] = True
            else:
                if dic[2] is False:
                    if t == k[2]:
                        dic[2] = True
                        return True
                else:
                    return True
    return False


N = int(eval(input()))
S = eval(input())
ans = 0
for i in range(0, 1000):
    if canMakeNumber(i, str(S)):
        ans += 1
print(ans)

-N = int(eval(input())) -S = eval(input()) -ans = 0 -for i in range(0, 1000): -    k = str(i).zfill(3) + + +def canMakeNumber(k, s): +    k = str(k).zfill(3) -    for t in str(S): +    for t in s: -                        ans += 1 -                        break +                        return True -                    ans += 1 -                    break +                    return True +    return False + + +N = int(eval(input())) +S = eval(input()) +ans = 0 +for i in range(0, 1000): +    if canMakeNumber(i, str(S)): +        ans += 1