object Main extends scala.App {
    import java.util
    import scala.collection._
    import scala.collection.mutable
    import scala.math._

    val sc = new java.util.Scanner(System.in)
    val N = sc.nextInt()
    val S = sc.next()

    val ans = (0 until 1000).foldLeft(0)((e, t) => {
        val t_str = "%03d".format(t)
        var fromIdx = 0
        val is = (0 until 3).map(i => {
            val idx = S.indexOf(t_str(i), fromIdx)
            if (idx >= 0) {
                fromIdx = idx + 1
            } else {
                fromIdx += 1
            }
            idx
        }).forall(_ >= 0)
        if (is) {
            e + 1
        } else {
            e
        }
    })
    println(ans)
}