In each operation you can choose an interval [l,r] and reverse the elements pl,pl+1,…,pr to pr,pr−1,…,pl,
the weight of this operation is r−l+1.
You can perform any number of operations,
and your goal is to make pi=i at last.
Please calculate the minimal and maximal XOR
sum of the weight of all the operations.
The first line of each test case contains
one integer n (1≤n≤105).
The second line contains n integers p1,p2,…,pn.
It's guaranteed that ∑n≤6×105.
3
3
1 3 2
3
3 1 2
6
1 2 5 6 3 4
2 3
0 1
0 5