"use strict";

const main = arg => {
    const input = arg.trim().split("\n");
    const N = parseInt(input[0].split(" ")[0]);
    const S = "" + input[1].split(" ")[0];
    let ans = 0;
    for (let num = 0; num < 1000; num++) {
        // 整数にする
        const i1 = parseInt(num / 100) % 10;
        const i2 = parseInt(num / 10) % 10;
        const i3 = num % 10;
        const idx1 = S.indexOf("" + i1);
        if (idx1 >= 0) {
            const idx2 = S.indexOf("" + i2, idx1 + 1);
            if (idx2 >= 0) {
                const idx3 = S.indexOf("" + i3, idx2 + 1);
                if (idx3 >= 0) {
                    ans++;
                }
            }
        }
    }
    console.log(ans);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
