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

    var cnt = 0
    for (i in 0..999) {
        val num = i.toString().padStart(3, '0')

        var num1Found = false
        var num2Found = false

        inner@for(i in s.indices) {
            if (num2Found && s[i] == num[2]) {
                cnt++
                break@inner
            } else if (num1Found && s[i] == num[1]) {
                num2Found = true
            } else if (s[i] == num[0]) {
                num1Found = true
            }
        }
    }

    println(cnt)
}