module Main where

import Control.Applicative
import Control.Monad
import Data.List

count :: String -> String -> Int
count xs ys = length $ filter (`elem` ys) (nub xs)

solve :: String -> Int
solve xs = maximum $ zipWith count (inits xs) (tails xs)

main :: IO ()
main = do
    getLine
    ss <- getLine
    print $ solve ss