import sys

read = sys.stdin.read

readline = sys.stdin.readline

readlines = sys.stdin.readlines



def main():

    N = int(readline())

    S = readline().strip()



    ans = 0

    for p in range(1000):

        pattern = str(p).zfill(3)

        key = 0

        cnt = 0

        for n in pattern:

            for i in range(key,N):

                if S[i] == n:

                    key = i+1

                    cnt += 1

                    break

        if cnt == 3:

            ans += 1

    

    print(ans)





if __name__ == "__main__":

    main()

import sys

read = sys.stdin.read

readline = sys.stdin.readline

readlines = sys.stdin.readlines



def main():

    N = int(readline())

    S = readline().strip()



    ans = 0

    for p in range(1000):

        pattern = str(p).zfill(3)

        cnt = 0

        T = S

        for n in pattern:

            i = T.find(n)

            if i != -1:

                T = T[i+1:]

                cnt += 1

        if cnt == 3:

            ans += 1

    

    print(ans)





if __name__ == "__main__":

    main()

import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines


def main():
    N = int(readline())
    S = readline().strip()
    ans = 0
    for p in range(1000):
        pattern = str(p).zfill(3)
        key = 0
        cnt = 0
        for n in pattern:
            for i in range(key, N):
                if S[i] == n:
                    key = i + 1
                    cnt += 1
                    break
        if cnt == 3:
            ans += 1
    print(ans)


if __name__ == "__main__":
    main()

import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines


def main():
    N = int(readline())
    S = readline().strip()
    ans = 0
    for p in range(1000):
        pattern = str(p).zfill(3)
        cnt = 0
        T = S
        for n in pattern:
            i = T.find(n)
            if i != -1:
                T = T[i + 1 :]
                cnt += 1
        if cnt == 3:
            ans += 1
    print(ans)


if __name__ == "__main__":
    main()

-        key = 0 +        T = S -            for i in range(key, N): -                if S[i] == n: -                    key = i + 1 -                    cnt += 1 -                    break +            i = T.find(n) +            if i != -1: +                T = T[i + 1 :] +                cnt += 1