object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt()
  val lr = List.fill(n)((sc.nextInt(), sc.nextInt()))
  val ans = lr.map{case (l, r) => r-l+1}.sum
  println(ans)
}
