import qualified Control.Monad as C
import qualified Data.List     as L

solve :: Int -> IO ()
solve n = do
    rideAndLeftTimes <- C.forM [1..n] $ \_ -> do
        [ride, left] <- map read . words . filter (/= ':') <$> getLine :: IO [Int]
        return (ride, left)
    let rides = map (\x -> (x,  1)) $ map fst rideAndLeftTimes
    let lefts = map (\x -> (x, -1)) $ map snd rideAndLeftTimes
    print . maximum . scanl (+) 0 . map snd . L.sort $ rides ++ lefts
    main

main :: IO ()
main = do
    n <- read <$> getLine :: IO Int
    C.when (n /= 0) $ solve n


