import qualified Data.Map as M

main = do
  li <- getLine
  let n = read li
  s <- getLine
  let ans = compute n s
  print ans

{-
より数学チックに書きたいから書く
左はカウントする意味すらない。Setでいい。
-}

compute :: Int -> String -> Int
compute n s = maximum $ map comCnt $ scanl step (l0,r0) s
  where
    l0 = M.empty
    r0 = M.fromListWith (+) [ (c,1) | c <- s ]
    step (lm,rm) c = (M.insert c () lm, M.update decl c rm)
    decl 1 = Nothing
    decl n = Just (pred n)
    comCnt = M.size . uncurry (M.intersectionWith const)
