import java.util.Scanner

object Main extends App{
  val sc = new Scanner(System.in)

  val n = sc.nextInt
  val tl = Seq.fill(n)((sc.nextInt, sc.nextInt))

  val res = tl.foldLeft(0L){case (sum, (left, right)) =>
      sum + (right - left + 1)
  }

  println(res)
}