
import scala.io.StdIn

object Main extends App {
  val n = StdIn.readLine().toInt
  val s = StdIn.readLine()

  val all = s.distinct.sorted
  val r = (1 until n).foldLeft(0) { (ac, index) =>
    val r = s.splitAt(index)
    //println(r)
    scala.math.max(ac, all.foldLeft(0){ (acc, c) =>
      acc + (if(r._1.contains(c) && r._2.contains(c)) 1 else 0)
    })
  }
  
  println(r)
}
