fun main(args: Array<String>) {
    var r = 0
    for (i in 0 until readLine()!!.toInt()){
        var (s,e) = readLine()!!.split(" ").map(String::toInt)
        r += (e - s + 1)
    }
    println(r)
}