{-# OPTIONS_GHC -O2 -funbox-strict-fields #-}
import qualified Data.ByteString.Char8 as BS
import           Data.Maybe            (fromJust)

main :: IO ()
main = do
  n <- readLn
  lrs <- map (map readInt . BS.words) . BS.lines <$> BS.getContents
  print $ solve n lrs

solve :: Int -> [[Int]] -> Int
solve _ = sum . map (\[l, r] -> r - l + 1)

readInt :: BS.ByteString -> Int
readInt = fst . fromJust . BS.readInt
