import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val n = sc.nextInt()

    var ans = 0L
    for (i <- 0 until n) {
      val a, b = sc.nextInt()
      ans += b - a + 1
    }

    println(ans)
  }
}
