#include <bits/stdc++.h>
using namespace std;
void solve(int z) {
  long long int n;
  cin >> n;
  vector<int> arr(n);
  for (int i = 0; i < n; i++) cin >> arr[i];
  int cnt = 1, ans = 0;
  while (!is_sorted(arr.begin(), arr.end())) {
    if (cnt) {
      for (int i = 0; i + 1 < n; i += 2) {
        if (arr[i] > arr[i + 1]) {
          swap(arr[i], arr[i + 1]);
        }
      }
    } else {
      for (int i = 1; i + 1 < n; i += 2) {
        if (arr[i] > arr[i + 1]) {
          swap(arr[i], arr[i + 1]);
        }
      }
    }
    cnt = 1 - cnt;
    ans++;
  }
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  int c = 1;
  while (t--) {
    solve(c);
    c++;
  }
  return 0;
}
