import java.util.*


fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)

    var N: Long
    N = sc.nextLong()
    val l = Array((N).toInt()){0L}
    val r = Array((N).toInt()){0L}
    for (i in 0 until N) {
        l[(i).toInt()] = sc.nextLong()
        r[(i).toInt()] = sc.nextLong()
    }
    solve(N, l, r)
}

fun solve(N: Long, l: Array<Long>, r: Array<Long>) {
    var res = 0L
    for (i in l.indices) {
        res += r[i] - l[i] + 1
    }
    println(res)
}

