import java.io._
import java.util.StringTokenizer
import scala.util.control.Breaks.{breakable,break}
import scala.collection.mutable.{Map, Stack, Queue, PriorityQueue, Set}

object Main extends App {
  val in = new InputReader(System.in)
  val pw = new PrintWriter(System.out)

  val N = in.next().toInt
  val S = in.next()

  // val a = new Array[Int](N)

  val ans = Set[String]()

  var dp = Set[String]()

  for (c <- S) {
    val next = Set[String]()
    next += c.toString
    for (s <- dp) {
      s.length match {
        case 2 =>
          ans += s + c
          next += s
        case _ =>
          next += s + c
          next += s
      }
    }

    dp = next
  }


  println(ans.size)
}

object Sub {
  def print2DimArray[A](mat: Array[Array[A]]): Unit = {
    mat.foreach(lin => println(lin.deep))
  }
}

class InputReader(stream: InputStream) {
  private[this] val reader = new BufferedReader(new InputStreamReader(stream))
  private[this] var tokenizer: StringTokenizer = new StringTokenizer(reader.readLine())
  def next(): String = {
    while (!tokenizer.hasMoreTokens()) {
      tokenizer = new StringTokenizer(reader.readLine())
    }
    tokenizer.nextToken()
  }
}
