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

    var ans = 0

    for (i in '0'..'9') {
        var pos1 = 0
        var ok = false
        for (c in 0 until S.size) {
            if (S[c] == i) {
                ok = true
                pos1 = c + 1
                break
            }
        }
        if (!ok) {
            continue
        }
        for (j in '0'..'9') {
            var pos2 = 0
            ok = false
            for (c in pos1 until S.size) {
                if (S[c] == j) {
                    ok = true
                    pos2 = c + 1
                    break
                }
            }
            if (!ok) {
                continue
            }
            for (k in '0'..'9') {
                ok = false
                for (c in pos2 until S.size) {
                    if (S[c] == k) {
                        ok = true
                        break
                    }
                }
                if (ok) {
                    ans++
                }
            }
        }
    }

    println(ans)
}

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