object Main {
  class Solver(n: Int, s: String) {
    def nChar: (String, String) => Int = (x, y) => {
      val charCollection = 'a' to 'z' filter { (c) => (x.contains(c) && y.contains(c)) }
      charCollection.length
    }

    def solve: Int = {
      val li = for (i <- 1 to n-1) yield nChar(s.slice(0, i), s.slice(i, n))
      li.max
    }
  }
  
  def main(args: Array[String]): Unit = {
    val n = io.StdIn.readLine().toInt
    val s = io.StdIn.readLine()
    val solver = new Solver(n, s)
    println(solver.solve)
  }
}

