Time Limit: 4 Sec Memory Limit: 512 MB
Anton likes permutations, especially he likes to permute their elements. Note that a permutation of elements is a sequence of numbers , in which every number from to appears exactly once.
One day Anton got a new permutation and started to play with it. He does the following operation times: he takes two elements of the permutation and swaps these elements. After each operation he asks his friend Vanya, how many inversions there are in the new permutation. The number of inversions in a permutation is the number of distinct pairs such that and .
Vanya is tired of answering Antons silly questions. So he asked you to write a program that would answer these questions instead of him.
Initially Antons permutation was , that is for all such that .
The first line of the input contains two integers and (, ) — the length of the permutation and the number of operations that Anton does.
Each of the following lines of the input contains two integers and () — the indices of elements that Anton swaps during the -th operation. Note that indices of elements that Anton swaps during the -th operation can coincide. Elements in the permutation are numbered starting with one.
Output lines. The -th line of the output is the number of inversions in the Antons permutation after the -th operation.
Sample Input #1:
Sample Output #1:
Consider the first sample.
After the first Antons operation the permutation will be . There is only one inversion in it: .
After the second Antons operation the permutation will be . There are four inversions: , , and .
After the fourth Antons operation the permutation doesnt change, so there are still three inversions.