import Data.List

main = do
    (n:_) <- (fmap read . words) <$> getLine
    str <- getLine
    
    -- break list
    let numList b = [(isInfixOf [c] $ take b str) && (isInfixOf [c] $ drop b str) | c<-['a'..'z']]
    let ansList = [count True $ numList b | b<-[1..n] ]
    print $ maximum ansList


count :: Eq a => a -> [a] -> Int
count c = length . filter (c==)
