A workshop logs n machine run intervals, each the half-open interval [start, end). Report the total length of time during which at least one machine is running, counting any moment covered by several machines only once.
Input format
Line 1: an integer n.
Next n lines: two integers start end (with start < end).
Output format
A single integer: the total length of the union of all run intervals.
Constraints
- 1 ≤ n ≤ 100000
- 0 ≤ start < end ≤ 1000000