import sys

from itertools import product

from string import digits



def main():

    n, s = sys.stdin.read().split()

    n = int(n)



    cand = list(''.join(p) for p in product(digits, repeat=3))



    res = set()

    for c in cand:

        i = s.find(c[0])

        if i == -1:

            continue

        j = s.find(c[1], i+1)

        if j == -1:

            continue

        k = s.find(c[2], j+1)

        if k == -1:

            continue

        

        res.add(c)

        

    ans = len(res)

    print(ans)



if __name__ == '__main__':

    main()
import sys

from string import digits



def main():

    n, s = sys.stdin.read().split()



    res = []

    for i in digits:

        x = s.find(i)

        if x == -1:

            continue

        for j in digits:

            y = s.find(j, x+1)

            if y == -1:

                continue

            for k in digits:

                z = s.find(k, y+1)

                if z == -1:

                    continue

                res.append((i, j, k))



    print((len(res)))



if __name__ == '__main__':

    main()
import sys
from itertools import product
from string import digits


def main():
    n, s = sys.stdin.read().split()
    n = int(n)
    cand = list("".join(p) for p in product(digits, repeat=3))
    res = set()
    for c in cand:
        i = s.find(c[0])
        if i == -1:
            continue
        j = s.find(c[1], i + 1)
        if j == -1:
            continue
        k = s.find(c[2], j + 1)
        if k == -1:
            continue
        res.add(c)
    ans = len(res)
    print(ans)


if __name__ == "__main__":
    main()

import sys
from string import digits


def main():
    n, s = sys.stdin.read().split()
    res = []
    for i in digits:
        x = s.find(i)
        if x == -1:
            continue
        for j in digits:
            y = s.find(j, x + 1)
            if y == -1:
                continue
            for k in digits:
                z = s.find(k, y + 1)
                if z == -1:
                    continue
                res.append((i, j, k))
    print((len(res)))


if __name__ == "__main__":
    main()

-from itertools import product -    n = int(n) -    cand = list("".join(p) for p in product(digits, repeat=3)) -    res = set() -    for c in cand: -        i = s.find(c[0]) -        if i == -1: +    res = [] +    for i in digits: +        x = s.find(i) +        if x == -1: -        j = s.find(c[1], i + 1) -        if j == -1: -            continue -        k = s.find(c[2], j + 1) -        if k == -1: -            continue -        res.add(c) -    ans = len(res) -    print(ans) +        for j in digits: +            y = s.find(j, x + 1) +            if y == -1: +                continue +            for k in digits: +                z = s.find(k, y + 1) +                if z == -1: +                    continue +                res.append((i, j, k)) +    print((len(res)))