import Data.List

commonCharCounts :: (String, String) -> Int
commonCharCounts (c1, c2) = length $ intersect (nub c1) (nub c2)

solve :: Int -> String -> Int
solve n s = maximum $ map commonCharCounts split
  where split = [x | index <- [1..(n-1)], let x = splitAt index s]

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