main :: IO ()
main = do
    n <- read <$> getLine
    s <- getLine
    putStrLn $ show $ solve n s


solve :: Int -> String -> Int
solve n s = maximum $ map sameCount $ cutEnum n s


sameCount :: (String, String) -> Int
-- aとbに共に含まれる文字の数をカウント
-- ("aab", "bca") -> 2 ('a', 'b'が該当)

sameCount (a, b) =
    length [x | x <- ['a'..'z'], x `elem` a && x `elem` b]


cutEnum :: Int -> String -> [(String, String)]
-- 切断した文字列のペアを作成
-- "abcd" -> [("a", "bcd"), ("ab", "cd"), ("abc", "d")]

cutEnum 0 s = [splitAt 0 s]
cutEnum n s = (splitAt n s) : cutEnum (n - 1) s