fun main(args: Array<String>) {
    val n = readLine()?.toInt() ?: return
    val list = (0 until n).map {
        val (l, r) = readLine()?.split(" ")?.map { it.toInt() }!!
        l to r
    }
    val result = list.map { it.second - it.first + 1 }.sum()
    println(result)
}