fun main(args: Array<String>) {
    val N = nextInt()
    val S = next()
    var cnt = 0
    for (n in 0 until 1000) {
        val c = intArrayOf(n / 100, (n / 10) % 10, n % 10)
        var f = 0
        for (m in 0 until N) {
            if (S[m] == ('0' + c[f])) f += 1
            if (f == 3) break
        }
        if (f == 3) cnt += 1
    }

    println(cnt)
}
fun next() = readLine()!!
fun nextInt(delta: Int = 0) = Integer.parseInt(next()) + delta