import java.util.*

fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
    val S = readLine()!!
    val st = Array<TreeSet<String>>(4) { TreeSet<String>() }
    st[0].add("")

    for (i in S.indices) {
        for (j in 2 downTo 0) {
            for (t in st[j]) {
                st[j + 1].add(t + S[i])
            }
        }
    }

    println(st[3].size)
}