"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 re = new RegExp(i1 + ".*?" + i2 + ".*?" + i3);
        ans += re.test(S);
    }
    console.log(ans);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
