import sys

input = lambda: sys.stdin.readline().rstrip() 



def resolve():

    N = int(eval(input()))

    S = eval(input())



    ans = 0

    for i in range(1000):

        s = str(i).zfill(3)

        j = 0

        flg0 = False

        flg1 = False

        flg2 = False

        for j in S:

            if not flg0 and j==s[0]:

                flg0 = True

            elif flg0 and not flg1 and j==s[1]:

                flg1 = True

            elif flg0 and flg1 and not flg2 and j==s[2]:

                flg2 = True

        if flg0 and flg1 and flg2:

            ans +=1



    print(ans)



if __name__ == '__main__':

    resolve()

import sys

input = lambda: sys.stdin.readline().rstrip() 



def resolve():

    N = int(eval(input()))

    S = eval(input())



    ans = 0

    for i in range(1000):

        s = str(i).zfill(3)

        i0 = S.find(s[0])

        if i0 != -1:

            i1 = S[i0+1:].find(s[1])

            if i1 != -1:

                i2 = S[i0+i1+2:].find(s[2])

                if i2 != -1:

                    ans += 1



    print(ans)



if __name__ == '__main__':

    resolve()

import sys

input = lambda: sys.stdin.readline().rstrip()


def resolve():
    N = int(eval(input()))
    S = eval(input())
    ans = 0
    for i in range(1000):
        s = str(i).zfill(3)
        j = 0
        flg0 = False
        flg1 = False
        flg2 = False
        for j in S:
            if not flg0 and j == s[0]:
                flg0 = True
            elif flg0 and not flg1 and j == s[1]:
                flg1 = True
            elif flg0 and flg1 and not flg2 and j == s[2]:
                flg2 = True
        if flg0 and flg1 and flg2:
            ans += 1
    print(ans)


if __name__ == "__main__":
    resolve()

import sys

input = lambda: sys.stdin.readline().rstrip()


def resolve():
    N = int(eval(input()))
    S = eval(input())
    ans = 0
    for i in range(1000):
        s = str(i).zfill(3)
        i0 = S.find(s[0])
        if i0 != -1:
            i1 = S[i0 + 1 :].find(s[1])
            if i1 != -1:
                i2 = S[i0 + i1 + 2 :].find(s[2])
                if i2 != -1:
                    ans += 1
    print(ans)


if __name__ == "__main__":
    resolve()

-        j = 0 -        flg0 = False -        flg1 = False -        flg2 = False -        for j in S: -            if not flg0 and j == s[0]: -                flg0 = True -            elif flg0 and not flg1 and j == s[1]: -                flg1 = True -            elif flg0 and flg1 and not flg2 and j == s[2]: -                flg2 = True -        if flg0 and flg1 and flg2: -            ans += 1 +        i0 = S.find(s[0]) +        if i0 != -1: +            i1 = S[i0 + 1 :].find(s[1]) +            if i1 != -1: +                i2 = S[i0 + i1 + 2 :].find(s[2]) +                if i2 != -1: +                    ans += 1