import Control.Monad

main :: IO ()
main = print =<< solve . parse .lines <$>  getContents

parse :: [String] -> (Int, Int, [[Int]])
parse ls = (h, w, boards)
  where
    [_, h, w] = map read . words . head $ ls
    boards = map (map read . words) . tail $ ls

solve :: (Int, Int, [[Int]]) -> Int
solve (h, w, bs) = length . filter isValid $ bs
  where
    isValid [a, b] = (a >= h) && (b >= w)