#include <bits/stdc++.h>
const unsigned int M = 1000000007;
using namespace std;
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "[";
  for (int i = 0; i < v.size(); ++i) {
    os << v[i];
    if (i != v.size() - 1) os << ", ";
  }
  os << "]\n";
  return os;
}
template <typename T, typename S>
ostream &operator<<(ostream &os, const map<T, S> &v) {
  for (auto it : v) os << it.first << " : " << it.second << "\n";
  return os;
}
template <typename T, typename S>
ostream &operator<<(ostream &os, const pair<T, S> &v) {
  os << "(";
  os << v.first << ", " << v.second << ")";
  return os;
}
template <typename T, typename S>
ostream &operator<<(ostream &os, const unordered_map<T, S> &v) {
  for (auto it : v) os << it.first << " : " << it.second << "\n";
  return os;
}
template <typename T>
istream &operator>>(istream &input, vector<T> &v) {
  for (auto &i : v) cin >> i;
  return input;
}
vector<string> vec_splitter(string s) {
  s += ',';
  vector<string> res;
  while (!s.empty()) {
    res.push_back(s.substr(0, s.find(',')));
    s = s.substr(s.find(',') + 1);
  }
  return res;
}
void debug_out(vector<string> __attribute__((unused)) args,
               __attribute__((unused)) int idx,
               __attribute__((unused)) int LINE_NUM) {
  cerr << endl;
}
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
  if (idx > 0)
    cerr << ", ";
  else
    cerr << "Line(" << LINE_NUM << ") ";
  stringstream ss;
  ss << H;
  cerr << args[idx] << " = " << ss.str();
  debug_out(args, idx + 1, LINE_NUM, T...);
}
const int MOD = 1e7 + 9;
using i64 = long long;
long long norm(long long n) {
  if (n < 0) {
    n += MOD;
  }
  if (n >= MOD) {
    n -= MOD;
  }
  return MOD;
}
template <class T>
T power(T a, long long b) {
  T res = 1;
  for (; b; b /= 2, a *= a) {
    if (b % 2) {
      res *= a;
    }
  }
  return res;
}
struct Z {
  int x;
  Z(int x = 0) : x(norm(x)) {}
  int val() const { return x; }
  Z operator-() const { return Z(norm(MOD - x)); }
  Z inv() const {
    assert(x != 0);
    return power(*this, MOD - 2);
  }
  Z &operator*=(const Z &rhs) {
    x = i64(x) * rhs.x % MOD;
    return *this;
  }
  Z &operator+=(const Z &rhs) {
    x = norm(x + rhs.x);
    return *this;
  }
  Z &operator-=(const Z &rhs) {
    x = norm(x - rhs.x);
    return *this;
  }
  Z &operator/=(const Z &rhs) { return *this *= rhs.inv(); }
  friend Z operator*(const Z &lhs, const Z &rhs) {
    Z res = lhs;
    res *= rhs;
    return res;
  }
  friend Z operator+(const Z &lhs, const Z &rhs) {
    Z res = lhs;
    res += rhs;
    return res;
  }
  friend Z operator-(const Z &lhs, const Z &rhs) {
    Z res = lhs;
    res -= rhs;
    return res;
  }
  friend Z operator/(const Z &lhs, const Z &rhs) {
    Z res = lhs;
    res /= rhs;
    return res;
  }
};
void solve() {
  long long n, i;
  cin >> n;
  vector<long long> arr(n);
  cin >> arr;
  long long cnt = 0;
  bool flag = 1;
  while (!is_sorted(arr.begin(), arr.end())) {
    if (flag == 1) {
      for (i = 0; i < n - 1; i += 2) {
        if (arr[i + 1] < arr[i]) swap(arr[i], arr[i + 1]);
      }
      flag = 0;
    } else {
      for (i = 1; i < n; i += 2) {
        if (arr[i] > arr[i + 1]) swap(arr[i], arr[i + 1]);
      }
      flag = 1;
    }
    cnt++;
  }
  cout << cnt << "\n";
}
int main() {
  ;
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long t = 1;
  cin >> t;
  long long __t = t;
  while (t--) {
    solve();
  }
  return 0;
}

### Prompt

Create a solution in cpp for 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>
const unsigned int M = 1000000007;
using namespace std;
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "[";
  for (int i = 0; i < v.size(); ++i) {
    os << v[i];
    if (i != v.size() - 1) os << ", ";
  }
  os << "]\n";
  return os;
}
template <typename T, typename S>
ostream &operator<<(ostream &os, const map<T, S> &v) {
  for (auto it : v) os << it.first << " : " << it.second << "\n";
  return os;
}
template <typename T, typename S>
ostream &operator<<(ostream &os, const pair<T, S> &v) {
  os << "(";
  os << v.first << ", " << v.second << ")";
  return os;
}
template <typename T, typename S>
ostream &operator<<(ostream &os, const unordered_map<T, S> &v) {
  for (auto it : v) os << it.first << " : " << it.second << "\n";
  return os;
}
template <typename T>
istream &operator>>(istream &input, vector<T> &v) {
  for (auto &i : v) cin >> i;
  return input;
}
vector<string> vec_splitter(string s) {
  s += ',';
  vector<string> res;
  while (!s.empty()) {
    res.push_back(s.substr(0, s.find(',')));
    s = s.substr(s.find(',') + 1);
  }
  return res;
}
void debug_out(vector<string> __attribute__((unused)) args,
               __attribute__((unused)) int idx,
               __attribute__((unused)) int LINE_NUM) {
  cerr << endl;
}
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
  if (idx > 0)
    cerr << ", ";
  else
    cerr << "Line(" << LINE_NUM << ") ";
  stringstream ss;
  ss << H;
  cerr << args[idx] << " = " << ss.str();
  debug_out(args, idx + 1, LINE_NUM, T...);
}
const int MOD = 1e7 + 9;
using i64 = long long;
long long norm(long long n) {
  if (n < 0) {
    n += MOD;
  }
  if (n >= MOD) {
    n -= MOD;
  }
  return MOD;
}
template <class T>
T power(T a, long long b) {
  T res = 1;
  for (; b; b /= 2, a *= a) {
    if (b % 2) {
      res *= a;
    }
  }
  return res;
}
struct Z {
  int x;
  Z(int x = 0) : x(norm(x)) {}
  int val() const { return x; }
  Z operator-() const { return Z(norm(MOD - x)); }
  Z inv() const {
    assert(x != 0);
    return power(*this, MOD - 2);
  }
  Z &operator*=(const Z &rhs) {
    x = i64(x) * rhs.x % MOD;
    return *this;
  }
  Z &operator+=(const Z &rhs) {
    x = norm(x + rhs.x);
    return *this;
  }
  Z &operator-=(const Z &rhs) {
    x = norm(x - rhs.x);
    return *this;
  }
  Z &operator/=(const Z &rhs) { return *this *= rhs.inv(); }
  friend Z operator*(const Z &lhs, const Z &rhs) {
    Z res = lhs;
    res *= rhs;
    return res;
  }
  friend Z operator+(const Z &lhs, const Z &rhs) {
    Z res = lhs;
    res += rhs;
    return res;
  }
  friend Z operator-(const Z &lhs, const Z &rhs) {
    Z res = lhs;
    res -= rhs;
    return res;
  }
  friend Z operator/(const Z &lhs, const Z &rhs) {
    Z res = lhs;
    res /= rhs;
    return res;
  }
};
void solve() {
  long long n, i;
  cin >> n;
  vector<long long> arr(n);
  cin >> arr;
  long long cnt = 0;
  bool flag = 1;
  while (!is_sorted(arr.begin(), arr.end())) {
    if (flag == 1) {
      for (i = 0; i < n - 1; i += 2) {
        if (arr[i + 1] < arr[i]) swap(arr[i], arr[i + 1]);
      }
      flag = 0;
    } else {
      for (i = 1; i < n; i += 2) {
        if (arr[i] > arr[i + 1]) swap(arr[i], arr[i + 1]);
      }
      flag = 1;
    }
    cnt++;
  }
  cout << cnt << "\n";
}
int main() {
  ;
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long t = 1;
  cin >> t;
  long long __t = t;
  while (t--) {
    solve();
  }
  return 0;
}

```