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 = list(eval(input()))



species_S_list = set(S)

ans = 0

for num in range(0, 1000):

    cnt = 0

    num_str = str(num).zfill(3)

    n0, n1, n2 = list(num_str)

    if n0 in species_S_list and n1 in species_S_list and n2 in species_S_list:

        index0 = S.index(n0)

        index2 = N - S[::-1].index(n2) - 1

        if index0 < index2:

            if n1 in S[index0 + 1: index2]:

                ans += 1

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 = list(eval(input()))
species_S_list = set(S)
ans = 0
for num in range(0, 1000):
    cnt = 0
    num_str = str(num).zfill(3)
    n0, n1, n2 = list(num_str)
    if n0 in species_S_list and n1 in species_S_list and n2 in species_S_list:
        index0 = S.index(n0)
        index2 = N - S[::-1].index(n2) - 1
        if index0 < index2:
            if n1 in S[index0 + 1 : index2]:
                ans += 1
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 - - -S = eval(input()) +S = list(eval(input())) +species_S_list = set(S) -for i in range(0, 1000): -    if canMakeNumber(i, str(S)): -        ans += 1 +for num in range(0, 1000): +    cnt = 0 +    num_str = str(num).zfill(3) +    n0, n1, n2 = list(num_str) +    if n0 in species_S_list and n1 in species_S_list and n2 in species_S_list: +        index0 = S.index(n0) +        index2 = N - S[::-1].index(n2) - 1 +        if index0 < index2: +            if n1 in S[index0 + 1 : index2]: +                ans += 1