import scala.io.StdIn

object Main extends App {
  val n = StdIn.readInt
  val ans = Iterator.continually(StdIn.readLine)
    .take(n)
    .map(_.split(" "))
    .map(e => 1 + e(1).toInt - e(0).toInt)
    .sum

  println(ans)
}