(defn input []
  (->> (repeatedly (Integer/parseInt (read-line)) read-line)
    (map (comp (partial mapv #(Integer/parseInt %)) #(clojure.string/split % #"\s")))))

(defn Theater [Ss]
  (->> (map #(- (% 1) (% 0)) Ss)
    (map inc)
    (reduce +)))

(-> (input)
  Theater
  println)