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


numChar :: Char -> [Char] -> Int
numChar c = length . filter (c==)
