import qualified Data.List as L

bothContained :: (Eq a) => [a] -> [a] -> Int
bothContained _ [] = 0
bothContained xs (y:ys)
  | elem y xs = 1 + bothContained xs ys
  | otherwise = bothContained xs ys

solve s = maximum $ flip map [1.. length s - 1] $
  \n -> let (x,y) = splitAt n s in bothContained (L.nub x) (L.nub y)

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