object Main extends App {

  val n = scala.io.StdIn.readInt()
  val s = scala.io.StdIn.readLine()

  def solve(): Long = {
    var cnt = 0
    (0 to 999).foreach { i =>
      val numSeq: Seq[Int] = Seq(i / 100, (i / 10) % 10, i % 10)
      val lastIndex = numSeq.length - 1
      var numIndex = 0

      val sLength = s.length
      var j = 0
      while(j < sLength) {
        if(s(j).toString == numSeq(numIndex).toString) {
          numIndex += 1
          if(numIndex == lastIndex + 1)  j = sLength // break loop
        }
        j += 1
      }
      if(numIndex == lastIndex + 1) cnt += 1
    }
    cnt
  }
  println(solve)

}
