fun main(args: Array<String>) {
    val n = readInteger()
    val s = readLine()!!

    var ans = 0
    for (i in 0..9) {
        for (j in 0..9) {
            for (k in 0..9) {
                if (existedOn(s, i, j, k)) {
                    ans++
                }
            }
        }

    }
    ans.let(::println)
}

fun existedOn(s: String, i: Int, j: Int, k: Int): Boolean {
    val a = s.indexOf(i.toString())
    if (a == -1 || a == s.length - 1) { return false }

    val b = s.indexOf(j.toString(), a + 1)
    if (b == -1 || b == s.length - 1) { return false }

    val c = s.indexOf(k.toString(), b + 1)
    if (c == -1) { return false }

    return true
}

fun readInteger() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)
fun readLongList() = readStringList().map(String::toLong)
