import scala.io.StdIn

object Main extends App {

  val n = StdIn.readLine().toInt
  val r = (0 until n).foldLeft(0) { (acc, _) =>
    val a = StdIn.readLine().split(' ').map(_.toInt)
    acc + (a(1) - a(0)) + 1
  }
  println(r)

}
