import Data.Set as S

main :: IO ()
main = do
  _ <- readLn
  s <- getLine
  print $  solve S.empty S.empty s

solve :: S.Set Char -> S.Set Char -> Int -> String -> Int
solve _ _ cnt [] = cnt
solve l r cnt (c:cs) = solve l' r' cnt' cs
  where
    l' = switch l c
    r' = switch r c
    cnt' = max cnt $ S.size $ S.intersection l' r'

switch :: S.Set Char -> Char -> S.Set Char
switch s c
  | c `S.member` s = S.delete c s
  | otherwise = S.insert c s
