CF540E Infinite Inversions

Description

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<j $ and $ p_{i}>p_{j} $ .

Input Format

N/A

Output Format

N/A

Explanation/Hint

In the first sample the sequence is being modified as follows: ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF540E/c911e52ddf33371777464860f326e25b9c055886.png). It has 4 inversions formed by index pairs $ (1,4) $ , $ (2,3) $ , $ (2,4) $ and $ (3,4) $ .