main = do
    n <- readLn :: IO Int
    print =<< countAll 1 n

i_n :: IO Int
i_n = do
    lr <- (map read . words) <$> getLine :: IO [Int]
    return (count lr)

count :: [Int] -> Int
count [l,r] = r-l+1


countAll :: Int -> Int -> IO Int
countAll n m
 | n == m = i_n
 | otherwise =  ((return (+)) <*> i_n)  <*>  (countAll (n+1) m)