fun main(args: Array<String>){

    var N = readLine()!!.toInt()
    var S = readLine()!!
    var ans = 0

    for(i in 0..9){
        for(j in 0..9){
            for(k in 0..9){
                var iPos = S.indexOf(i.toString())
                if(iPos != -1){
                    var jPos = S.indexOf(j.toString(),iPos+1)
                    if(jPos != -1){
                        if(S.indexOf(k.toString(),jPos+1) != -1){
                            ans++
                        }
                    }

                }


            }
        }
    }

    print(ans)


}
