let () =
  let n = Scanf.scanf "%d\n" (fun n -> n) in
  let lrs = Array.init n (fun _ -> Scanf.scanf "%d %d\n" (fun l r -> l, r)) in
  Array.fold_left (fun a (l, r) -> a + r - l + 1) 0 lrs
  |> Printf.printf "%d\n"