fun main(args: Array<String>) {
    val N = readInputLine().toInt()
    val S = readInputLine().toCharArray()

    val nums = BooleanArray(1000)
    
    nums[(S[0] - '0').toInt() * 100 + (S[1] - '0').toInt() * 10 + (S[2] - '0').toInt()] = true

    for (i in 3 until S.size) {
        val num = (S[i] - '0').toInt()
        val added = mutableSetOf<Int>()
        for (j in 0..999) {
            if (nums[j]) {
                val digit1 = j / 100
                val digit2 = (j - digit1 * 100) / 10
                val digit3 = j % 10
                added.add(digit1 * 100 + digit2 * 10 + num)
                added.add(digit1 * 100 + digit3 * 10 + num)
                added.add(digit2 * 100 + digit3 * 10 + num)
            }
        }
        for (a in added) {
            nums[a] = true
        }
    }
    
    var ans = 0
    
    for (i in 0..999) {
        if (nums[i]) {
            ans++
        }
    }

    println(ans)
}

fun readInputLine(): String {
    return readLine()!!
}
