import scala.io.{StdIn => in}
import scala.collection.{mutable => mu}

object Main extends App {
  import MapHelper._
  val n = in.readInt
  val s = in.readLine

  val ans = (1 until n)./:(0)( (acc, i) => {
    val map = mu.HashMap.empty[Char,Int]
    val sf = s.take(i).toSet.toArray
    val sr = s.drop(i).toSet.toArray
    sf.foreach(ch => map.addOrUpdate(ch,1))
    sr.foreach(ch => map.addOrUpdate(ch,1))
    acc max map.values.count(_ == 2)
  })

  println(ans)

  object MapHelper {
    implicit class AddOrUpdate[A](map:mu.HashMap[Char,Int]) {
      def addOrUpdate(key:Char, value:Int):mu.HashMap[Char,Int] =
      {
        if(map.contains(key)) map(key) += value
        else map += (key -> value)
        map
      }
    }
  }
}