fun main(args: Array<String>) {
    val (N) = readLine()!!.split(' ').map(String::toInt)
    val S = readLine()!!

    var ans = 0
    for (i in 0..9) {
        for (j in 0..9) {
            for (k in 0..9) {
                var d = 0
                for ((p, c) in S.toCharArray().withIndex()) {
                    if (d == 0 && i == c - '0') d += 1
                    else if (d == 1 && j == c - '0') d += 1
                    else if (d == 2 && k == c - '0') d += 1
                }
                if (d == 3) {
                    ans += 1
                    //println("$i$j$k")
                }

            }
        }
    }
    println(ans)


//    val dp = Array(50000) { Array(4) {Array (10) {0}  } }
//    for ((i, c) in S.toCharArray().withIndex()) {
//        val digit = c - '0'
//        dp[i+1] = dp[i].copyOf()
//        for (l in 1..2) {
//            for (d in 0..9) {
//                dp[i+1][l+1][digit] += dp[i][l][d]
//            }
//        }
//        dp[i+1][1][digit] = 1
//
//        println("from")
//        dp[i].forEach { l -> l.forEach { d -> print("$d ") }; println() }
//
//        println("to")
//        dp[i+1].forEach { l -> l.forEach { d -> print("$d ") }; println() }
//        println()
//    }
//    println(dp[N][3].sum())
}