### BUGGY CODE ###

import numpy as np
i8 = np.int64
i4 = np.int32


def solve(a, N):
    count = 0
    for x1 in range(10):
        for i1 in range(N):
            if a[i1] == x1:
                for x2 in range(10):
                    for i2 in range(i1 + 1, N):
                        if a[i2] == x2:
                            for x3 in range(10):
                                for i3 in range(i2 + 1, N):
                                    if a[i3] == x3:
                                        count += 1
                                        break
                            break
                break
    return count

def main2():
    stdin = open('/dev/stdin')
    N = int(stdin.readline())
    S = stdin.readline()
    a = np.empty(N, i8)
    for i in range(N):
        a[i] = int(S[i])
    print(solve(a, N))


main2()

### FIXED CODE ###

import subprocess
import gzip, base64, os
import stat

gz = b'H4sIAM+5410C/+1de3hTVbY/SfoIr6YIagXEiFGLQGlowRYfpI9Aoi1UWpDxwSEkaRtNk97kBMqICLb1GmuVmfHB5+dcGceZ63Xunet4HWUchTIo1XnJ6IzioIIP9ISCFh9YdTR3rb33Sfc5OaeA471/GWh21m+v/Vhrr7324zz2Te66hWaTSVA+ZuFSAam3TncR2sXwisYMC2AVwij4PkuYIuQBncvxuQSXKhxiWSuhlfFZ4C8H8zWz/M0uVTiF8SmhiQtzBf7jUoV9CwVVKAj2TDqs6956iu6tX6UK+ywUfzRPnc7M0g2xdEOMXwkFs6AKFfly2F8Tw5uYXEpYy/hqOX78NByUAvj74SpKP1zlUoUS45M06a6AdHnCiX8KWbiUlWekl2JWfyVU2mF2OLR6XvnscGBWOBRJdMzqqJg3a155STxaMofUqZDxLlq8TKXHIlbnicwGMH7ujIH1U//lpp5ZL6fWLLs3d+/kn9x3I8bNZuny4a87Utiac/YoM6bcCFlj3Bz4uxD+Hnu97G+jN20Wf+x/5rk72tLP39rtP+2vjVs7b/+e6+iso+LKAvua0mL33+ombhlb829T2ret817/hJFeLoGCT9HBTzPp448J+nhhxoLUn7MM8MEc/Xz+zQD/g0G5vzTgX52rjxcb4CED/DaD/BcZ8GMD6uHzDfjLDPQz2yCfGwzycRngSwzy/5GBPg8b4FMM6lNiUO4iA/tZYmBvVgP+Aw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S40noaXGk9LS8pPU0vKT19LyE628PybFpURzcwkeI3BZzVKxztvYJIrC8CEsotQGHQU8X1zQgUQxEBVbwtHVvrAYgH4VF32JDsEfbWsPB6VgoGReZcUcfSZx+NKdCIqPrRPo5b9Aoq1tHSThKHH4ih9jFcWFS6vq3aJ7cS0eJUNqzn4zqZcsXNjobhKbqqrr3MihyiKgBsjJCYJY+73FVfXeGgGvFSqY9hgOl4s/GoGdvOCPJ4g0QibVSZ7KoclV/4gYLZP+WTUqrpLKEzp1hxxckZ09dzxGVuSIx+Go6+B0Ckw7+kdsqPOmZ1owjJ1aQU7IUENZZ15oorNP/NC23PCpGtqkhsfWaLXwDY7PUWdBDvrQKT77eB1N0SOek7REJE/miIl4MJB9rI6mBrFgUF0BeuyIplIjnL2k7S2Gxyvp2VDWuSo6TPrHKmW1RfbpPtoWh4orTiLr+KHsHkgOydFmEYhHxVYYX0ByemCLrlWiP2ATh2/x7Kasnq054kgrQvZxQVppVsfjXMtlzqjKUu0JnbLjcnGHy2SfDaTb/bIOCsrORH1akl4u6jO+1DnongxmcNKWxg+Rk3Z0+uY3O5BK0+uC0Wat5WTO5VJLQAarb3YGlaZM8lyeVqATPwJKZ3wY6eAsDXuQ3ICjdyhWdpN/C2dDaSsLo4EGUp3GBHHssCTtKWbZfkE5/0pnOKYHXOkoSnu8lw4Lf5SUdkQMRQTqT/4XjCM/n+t3AAA='
bin = gzip.decompress(base64.b64decode(gz))
p = os.path.dirname(__file__)
pymain = os.path.join(p, "a.out")
with open(pymain, "wb") as f:
    f.write(bin)
os.chmod(pymain, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR)
if p == "":
    pymain = "./" + pymain
subprocess.call(pymain)


# compiled by pythran
'''
#pythran export main2()
import numpy as np
i8 = np.int64
i4 = np.int32


def solve(a, N):
    count = 0
    for x1 in range(10):
        for i1 in range(N):
            if a[i1] == x1:
                for x2 in range(10):
                    for i2 in range(i1 + 1, N):
                        if a[i2] == x2:
                            for x3 in range(10):
                                for i3 in range(i2 + 1, N):
                                    if a[i3] == x3:
                                        count += 1
                                        break
                            break
                break
    return count

def main2():
    stdin = open('/dev/stdin')
    N = int(stdin.readline())
    S = stdin.readline()
    a = np.empty(N, i8)
    for i in range(N):
        a[i] = int(S[i])
    print(solve(a, N))
'''