import scala.io.StdIn._
object Main extends App {
  val n = readInt
  val s = readLine

  val result = Array.tabulate(1000){ i => s.matches(s".*${i / 100}.*${i % 100 / 10}.*${i % 10}.*")}
  println(result.count(_ == true))
}