import Data.List
 
splits :: Int -> String -> [(String, String)]
splits 0 s = []
splits n s = splitAt (n-1) s : splits (n-1) s
 
kindMax :: [(String, String)] -> Int
kindMax xs = maximum $ map (kind.(\(s1, s2) -> (sort $ nub s1, sort $ nub s2))) xs
  where kind (s1, s2) = let tmp = s1 ++ s2 in length tmp - length (nub tmp)
 
main = do
  n <- fmap read getLine
  s <- getLine
  print $ kindMax (splits n s)