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 st = scala.collection.mutable.Set[String]()
    (0 until N)
            .combinations(3)
            .filter(t => (t(0) <= t(1) && t(1) <= t(2)))
            .foreach(t => {
                st.add(S(t(0)).toString + S(t(1)).toString + S(t(2)).toString)
            })
    println(st.size)
}