object MainKt {
  @JvmStatic fun main(args:Array<String>) {
    val N=readLine()!!.toInt()
    val lr= (1..N).map {
      val arg=readLine()!!.split(" ").map(String::toLong)
      Pair(arg[0],arg[1])
    }
    println(lr.map{
      val (l,r)=it
      r-l+1
    }.fold(0L) {sum,ele->sum+ele})
  }
}