open Printf
open Scanf

let () =
  let n = scanf "%d " (fun x -> x) in
  let rec loop i sm =
    if i = 0 then sm
    else let l, r = scanf "%d %d " (fun x y -> (x, y)) in loop (i-1) (sm + r - l + 1) in
  loop n 0 |> printf "%d\n"
