Problems
Fill the line
Fill the line
$n$ segments are painted on the line. The coordinates of the left and right ends of each segment $l_i$ and $r_i$ are known. Find the length of the colored part of the line.
\InputFile
The first line contains the number $n~(1 \le n \le 15000)$, the following $n$ lines contains the pair of integers $l_i$ and $r_i~(-10^9 \le l_i \le r_i \le 10^9)$.
\OutputFile
Print the length of the colored part of the line.
\includegraphics{https://static.e-olymp.com/content/af/af4ac546100dc0508705df27b02ec4168755102a.gif}
Input example #1
5 6 8 1 2 0 3 7 9 2 4
Output example #1
7