import Foundation
func toTuple<T>(_ args: [T]) -> (T, T) { (args[0], args[1]) }
func readInts() -> [Int] { readLine()!.split(separator: " ").map { Int($0)! } }

let n = Int(readLine()!)!
var ans = 0
for _ in 0..<n {
  let (l, r) = toTuple(readInts())
  ans += r - l + 1
}
print(ans)