open Printf
open Scanf

let id x = x

let n = scanf "%d" id

let vs = Array.init n @@ fun i -> scanf " %d %d" (fun l r -> l, r)

let () =
    let c = ref 0 in
    Array.iteri (fun i (l, r) -> c := !c + (r - l + 1)) vs;
    printf "%d\n" !c
