fun main(args: Array<String>) {
    val n = readInt()
    val s = readString()

    var ans = 0
    for (i in 0..999) {
        val l = String.format("%03d", i)
        var j = 0
        var one = true
        var two = true
        var three = true
        while (j < n) {
            when {
                one -> {
                    if (s[j] == l[0]) {
                        one = false
                    }
                }
                two -> {
                    if (s[j] == l[1]) {
                        two = false
                    }
                }
                three -> {
                    if (s[j] == l[2]) {
                        three = false
                    }
                }
            }
            if (!one && !two && !three) {
                ans++
                break
            }
            j++
        }

    }
    println(ans)
}

// Tools
fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()