A team's combined calendar is given as n busy intervals, each the half-open interval [start, end). After merging every overlapping or touching busy interval into solid blocks, the team is free during the gaps that lie strictly between consecutive blocks. Report the total length of these in-between free gaps. Time before the earliest busy moment and after the latest busy moment does not count.
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 free gaps between busy blocks.
Constraints
- 1 ≤ n ≤ 100000
- 0 ≤ start < end ≤ 1000000