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

    var ans = 0

    for (a in 0..9) {
        val d1 = a.toString()
        for (b in 0..9) {
            val d2 = b.toString()
            for (c in 0..9) {
                val d3 = c.toString()

                for (i in 0 until n-2) {
                    if (d1 == s[i].toString()) {
                        for (j in i + 1 until n - 1) {
                            if (d2 == s[j].toString()) {
                                for (k in j + 1 until n) {
                                    if (d3 ==  s[k].toString()) {
                                        ans++
                                        break
                                    }
                                }
                                break
                            }
                        }
                        break
                    }
                }
            }
        }
    }
    println(ans)
}
