import scala.collection.immutable.{Stack, Queue}
import scala.collection.mutable.{ArrayBuffer, ListBuffer}

object Main extends App{
    val sc = new java.util.Scanner(System.in)
    val n = sc.nextInt
    val s = sc.next
    
    def seqFromString(s: String): Seq[Char] = (0 until s.length).map(i => s.charAt(i))
    
    // println(s"${seqFromString(s).toSet}")
    
    def aAndB(a: String, b: String): Int = {
        val va = seqFromString(a).toSet
        val vb = seqFromString(b).toSet
        (va intersect vb).size
    }

    val splits = (1 until s.length-1).map(x => {
        s.splitAt(x) match {
            case (a, b) => {
                aAndB(a, b)
            }
        }
    })
    
    println(s"${splits.foldLeft(0)((acc, x) => Math.max(acc, x))}")
}
