import Control.Applicative
import Data.List

solve :: Int -> String -> Int
solve n s = maximum (map (\i -> numContainedBoth (take i s) (drop i s)) [1..n-1])

numContainedBoth :: (Eq a) => [a] -> [a] -> Int
numContainedBoth x y = length (intersect (nub x) (nub y))

main :: IO ()
main = do
    n <- readLn
    s <- getLine
    putStrLn $ show (solve n s)
