import Data.List

main = do
  cs <- getContents
  let n = (read :: String -> Int) . head . lines $ cs
  case (n < length (nub (tail (lines cs)))) of
    True -> print n
    _    -> print . length . nub . tail $ lines cs