A radio station schedules n broadcast windows on a minute-numbered timeline. Each window covers the half-open range from its start minute up to (but not including) its end minute. Windows may overlap, touch, be nested, or be empty (start equal to end). Compute the total number of minutes that lie inside at least one window; a minute covered by several windows still counts only once.
Input format
Line 1: an integer n.
Next n lines: two integers start and end describing one window.
Output format
A single integer: the total number of covered minutes (the length of the union of all windows).
Constraints
- 1 ≤ n ≤ 100000
- 0 ≤ start ≤ end ≤ 1000000000