{-# OPTIONS_GHC -O2 -funbox-strict-fields #-}
import qualified Data.Set as S

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

solve :: Int -> String -> Int
solve n s = maximum . map count $ splits n s

splits :: Int -> [a] -> [([a], [a])]
splits n xs = [splitAt i xs | i <- [0 .. n-1]]

count :: Ord a => ([a], [a]) -> Int
count (xs, ys) = S.size $ S.intersection xs' ys' where
  xs' = S.fromList xs
  ys' = S.fromList ys
