import qualified Data.Set as Set
import Control.Monad


isBothMember :: Ord a => Set.Set a -> Set.Set a -> a -> Bool
isBothMember xs ys x
  | (Set.member x xs) && (Set.member x ys) = True
  | otherwise = False

countUniq :: String -> Int -> Int
countUniq xs n =
  let a = Set.fromList $ take n xs
      b = Set.fromList $ drop n xs
  in length $ filter (==True) $ map (isBothMember a b) ['a'..'z']


countMax :: String -> Int
countMax xs = foldr1 max $ map (countUniq xs) [0..n]
  where n = length xs



main :: IO ()
main = do
  _ <- getLine
  xs <- getLine                                                                                                            

  print $ countMax xs