open Batteries
let () =
  let n = Scanf.scanf "%d " (fun a -> a) in
  let pair_lst = Array.to_list @@ Array.init n (fun _ -> Scanf.scanf "%d %d " (fun a b -> a,b)) in

  Printf.printf "%d\n" @@
  List.fold_left (fun acc (x,y) -> acc+(y-x+1)) 0 pair_lst
