#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long modx = 998244353;
long double PI = 3.1415926535897;
const long long N = 200010;
unsigned long long pows(unsigned long long x1, long long y1, long long mod) {
  unsigned long long r1 = 1;
  x1 = x1 % mod;
  while (y1 > 0) {
    if (y1 & 1) r1 = (r1 * x1) % mod;
    y1 = y1 >> 1;
    x1 = (x1 * x1) % mod;
  }
  return r1;
}
unsigned long long f[N];
unsigned long long mi(unsigned long long x, long long mod) {
  return pows(x, mod - 2, mod);
}
unsigned long long ncr(unsigned long long x, long long y, long long mod) {
  if (x < y) return 0;
  if (y == 0) return 1;
  long long ans = f[x] * mi(f[y], mod) % mod;
  long long z = (ans * mi(f[x - y], mod) % mod) % mod;
  return z % mod;
}
void solve();
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    solve();
    cout << "\n";
  }
  cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl;
  return 0;
}
long long ceils(long long x, long long y) { return x / y + ((x % y) != 0); }
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
long long powmod(long long x, long long y) {
  long long res = 1;
  for (long long i = 0; i < y; i++) {
    res = res * x % MOD;
  }
  return res;
}
bool isPrime(long long n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (long long i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
bool COMP(pair<long long, long long> l, pair<long long, long long> r) {
  return l.second < r.second;
}
long long kadanesAlgo(vector<long long> a) {
  long long n = a.size();
  long long currMax = 0;
  long long mx = INT_MIN;
  for (long long i = 0; i < n; i++) {
    currMax += a[i];
    if (currMax <= a[i]) {
      currMax = a[i];
    }
    mx = max(currMax, mx);
  }
  return mx;
}
string ask(long long x, long long y) {
  cout << x + 1 << " " << y + 1;
  string s;
  cin >> s;
  return s;
}
long long binpow(long long a, long long b, long long m) {
  a %= m;
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % m;
    a = a * a % m;
    b >>= 1;
  }
  return res;
}
void solve() {
  long long n;
  cin >> n;
  vector<long long> a(n, 0);
  for (long long i = 0; i < n; i++) {
    long long x;
    cin >> x;
    a[i] = x;
  }
  vector<long long> b = a;
  sort((b).begin(), (b).end());
  if (a == b) {
    cout << 0;
    return;
  }
  long long cnt = 0, x = 1;
  while (true) {
    if (a == b) break;
    if (x % 2) {
      for (long long i = 0; i < n - 1; i += 2) {
        if (a[i] > a[i + 1]) {
          swap(a[i], a[i + 1]);
        }
      }
    } else {
      for (long long i = 1; i < n - 1; i += 2) {
        if (a[i] > a[i + 1]) {
          swap(a[i], a[i + 1]);
        }
      }
    }
    x++;
    cnt++;
  }
  cout << cnt;
}

### Prompt

Please create a solution in Cpp to the following problem:

You have a permutation: an array a = [a_1, a_2, …, a_n] of distinct integers from 1 to n. The length of the permutation n is odd.

Consider the following algorithm of sorting the permutation in increasing order.

A helper procedure of the algorithm, f(i), takes a single argument i (1 ≤ i ≤ n-1) and does the following. If a_i > a_{i+1}, the values of a_i and a_{i+1} are exchanged. Otherwise, the permutation doesn't change.

The algorithm consists of iterations, numbered with consecutive integers starting with 1. On the i-th iteration, the algorithm does the following: 

  * if i is odd, call f(1), f(3), …, f(n - 2); 
  * if i is even, call f(2), f(4), …, f(n - 1). 



It can be proven that after a finite number of iterations the permutation will be sorted in increasing order.

After how many iterations will this happen for the first time?

Input

Each test contains multiple test cases. The first line contains the number of test cases t (1 ≤ t ≤ 100). Description of the test cases follows.

The first line of each test case contains a single integer n (3 ≤ n ≤ 999; n is odd) — the length of the permutation.

The second line contains n distinct integers a_1, a_2, …, a_n (1 ≤ a_i ≤ n) — the permutation itself. 

It is guaranteed that the sum of n over all test cases does not exceed 999.

Output

For each test case print the number of iterations after which the permutation will become sorted in increasing order for the first time.

If the given permutation is already sorted, print 0.

Example

Input


3
3
3 2 1
7
4 5 7 1 3 2 6
5
1 2 3 4 5


Output


3
5
0

Note

In the first test case, the permutation will be changing as follows: 

  * after the 1-st iteration: [2, 3, 1]; 
  * after the 2-nd iteration: [2, 1, 3]; 
  * after the 3-rd iteration: [1, 2, 3]. 



In the second test case, the permutation will be changing as follows: 

  * after the 1-st iteration: [4, 5, 1, 7, 2, 3, 6]; 
  * after the 2-nd iteration: [4, 1, 5, 2, 7, 3, 6]; 
  * after the 3-rd iteration: [1, 4, 2, 5, 3, 7, 6]; 
  * after the 4-th iteration: [1, 2, 4, 3, 5, 6, 7]; 
  * after the 5-th iteration: [1, 2, 3, 4, 5, 6, 7]. 



In the third test case, the permutation is already sorted and the answer is 0.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long modx = 998244353;
long double PI = 3.1415926535897;
const long long N = 200010;
unsigned long long pows(unsigned long long x1, long long y1, long long mod) {
  unsigned long long r1 = 1;
  x1 = x1 % mod;
  while (y1 > 0) {
    if (y1 & 1) r1 = (r1 * x1) % mod;
    y1 = y1 >> 1;
    x1 = (x1 * x1) % mod;
  }
  return r1;
}
unsigned long long f[N];
unsigned long long mi(unsigned long long x, long long mod) {
  return pows(x, mod - 2, mod);
}
unsigned long long ncr(unsigned long long x, long long y, long long mod) {
  if (x < y) return 0;
  if (y == 0) return 1;
  long long ans = f[x] * mi(f[y], mod) % mod;
  long long z = (ans * mi(f[x - y], mod) % mod) % mod;
  return z % mod;
}
void solve();
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    solve();
    cout << "\n";
  }
  cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl;
  return 0;
}
long long ceils(long long x, long long y) { return x / y + ((x % y) != 0); }
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
long long powmod(long long x, long long y) {
  long long res = 1;
  for (long long i = 0; i < y; i++) {
    res = res * x % MOD;
  }
  return res;
}
bool isPrime(long long n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (long long i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
bool COMP(pair<long long, long long> l, pair<long long, long long> r) {
  return l.second < r.second;
}
long long kadanesAlgo(vector<long long> a) {
  long long n = a.size();
  long long currMax = 0;
  long long mx = INT_MIN;
  for (long long i = 0; i < n; i++) {
    currMax += a[i];
    if (currMax <= a[i]) {
      currMax = a[i];
    }
    mx = max(currMax, mx);
  }
  return mx;
}
string ask(long long x, long long y) {
  cout << x + 1 << " " << y + 1;
  string s;
  cin >> s;
  return s;
}
long long binpow(long long a, long long b, long long m) {
  a %= m;
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % m;
    a = a * a % m;
    b >>= 1;
  }
  return res;
}
void solve() {
  long long n;
  cin >> n;
  vector<long long> a(n, 0);
  for (long long i = 0; i < n; i++) {
    long long x;
    cin >> x;
    a[i] = x;
  }
  vector<long long> b = a;
  sort((b).begin(), (b).end());
  if (a == b) {
    cout << 0;
    return;
  }
  long long cnt = 0, x = 1;
  while (true) {
    if (a == b) break;
    if (x % 2) {
      for (long long i = 0; i < n - 1; i += 2) {
        if (a[i] > a[i + 1]) {
          swap(a[i], a[i + 1]);
        }
      }
    } else {
      for (long long i = 1; i < n - 1; i += 2) {
        if (a[i] > a[i + 1]) {
          swap(a[i], a[i + 1]);
        }
      }
    }
    x++;
    cnt++;
  }
  cout << cnt;
}

```