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

    var pins = mutableSetOf<String>()

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

        for (j in s.indices) {
            if (s[j] == num[idx]) {
                idx++

                if (idx == 3) {
                    pins.add(num)
                    break
                }
            }
        }
    }

    println(pins.size)
}