segments are painted on the line. The coordinates of the left and right ends of each segment and are known. Find the length of the colored part of the line.
The first line contains the number , the following lines contains the pair of integers and .
Print the length of the colored part of the line.