Infinite Inversions
There is an infinite sequence consisting of all positive integers in the increasing order: *p*<==<={1,<=2,<=3,<=...}. We performed *n* swap operations with this sequence. A *swap*(*a*,<=*b*) is an operation of swapping the elements of the sequence on positions *a* and *b*. Your task is to find the number of inversions in the resulting sequence, i.e. the number of such index pairs (*i*,<=*j*), that *i*<=&lt;<=*j* and *p**i*<=&gt;<=*p**j*.
The first line contains a single integer *n* (1<=≤<=*n*<=≤<=105) — the number of swap operations applied to the sequence.

Each of the next *n* lines contains two integers *a**i* and *b**i* (1<=≤<=*a**i*,<=*b**i*<=≤<=109, *a**i*<=≠<=*b**i*) — the arguments of the swap operation.
Print a single integer — the number of inversions in the resulting sequence.
In the first sample the sequence is being modified as follows: <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/014a32f190673020641bf266b205f41f0a704f2d.png" style="max-width: 100.0%;max-height: 100.0%;"/>. It has 4 inversions formed by index pairs (1, 4), (2, 3), (2, 4) and (3, 4).