import Control.Monad

main::IO()
main=do
  nc<-getLine
  let n = read nc ::Int
  ls<-forM [1..n] (\_->getLine)
  let intpair= map (\s->map read (words s)) ls ::[[Int]]
  print (sum (map (\(a:b:[])->((b-a)+1)) intpair))