import Control.Monad.State
import Data.List

type Program = (Float, Float)

hoge :: Int -> State [Program] Int
hoge n = do pgms <- get
            case pgms of
              [] -> return n
              _  -> do put  ( devgrp [head pgms] (tail pgms) [] )
                       hoge (n + 1)

ison :: Program -> Program -> Bool
ison (f2, t2) (f1, t1)
  | t2 <= f1 || f2 >= t1 = False
  | otherwise            = True

devgrp :: [Program] -> [Program] -> [Program] -> [Program]
devgrp chs rst rtn
  | rst == []                 = rtn
  | any (ison (head rst)) chs = devgrp chs (tail rst) ((head rst):rtn)
  | otherwise                 = devgrp ((head rst):chs) (tail rst) rtn

ch :: String -> [Float]
ch xs = map read $ words xs

rf :: [String] -> Program
rf [x, y] = ((read x - 0.5), read y)
rf _ = (0.0, 0.0)

main :: IO ()
main = do
  cs <- getContents
  let inputs = map rf $ map init $ tail $ map words $ lines cs
  print $ fst $ runState (hoge 0) inputs