
fun main(args:Array<String>) {
    val n = readLine()!!.toInt()
    val s = readLine()!!.map { it - '0' }
    (0..9).forEach {
        dic[it] = mutableMapOf()
        dic[it]!![n] = -1
    }
    for(i in (0 until n).reversed()) {
        (0..9).forEach {
            if(it == s[i]) {
                dic[it]!![i] = i
            } else {
                dic[it]!![i] = dic[it]!![i+1]!!
            }
        }
    }
    var ans = 0
    for(i in (0..9)) {
        val index100 = dic[i]!![0]!!
        if(index100 < 0) {
            continue
        }
        for(j in (0..9)) {
            val index10 = dic[j]!![index100+1]!!
            if(index10 < 0) {
                continue
            }
            for(k in (0..9)) {
                val index1 = dic[k]!![index10+1]!!
                if(index1 > 0) {
                    ans++
                }
            }
        }
    }
    println(ans)
}


val dic = mutableMapOf<Int, MutableMap<Int, Int>>()