import Data.List
import Data.Set


main = do
    n <- getLine
    s <- getLine
    putStrLn $ show $ ans s

ans s = foldl1 max counts
    where
        counts = [overlapCount ls rs | (ls, rs) <- zip (inits s) (tails s)]
        overlapCount xs ys = size $ intersection (Data.Set.fromList xs) (Data.Set.fromList ys)
