import qualified Data.Set as S

f :: String -> S.Set Char -> Int
f [] s = 0
f (x:xs) s = max n (f xs s')
  where s' = S.insert x s
        t = S.fromList xs
        n = S.size (S.intersection s' t)

main = do
    n <- readLn :: IO Int
    s <- getLine
    print $ f s S.empty
