description: 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.
solution: 
  /*
      Author : Kartikey Rana
      from MSIT New Delhi
   */
  import java.util.*;
  import java.util.Arrays;
  import java.util.Collections;
  import javax.swing.text.html.HTMLDocument.HTMLReader.PreAction;
  import java.io.*;
  import java.math.*;
  import java.sql.Array;;
  
  public class Main {
  	static class FR {
  
  		BufferedReader br;
  		StringTokenizer st;
  
  		public FR() {
  			br = new BufferedReader(new InputStreamReader(System.in));
  		}
  
  		String next() {
  			while (st == null || !st.hasMoreElements()) {
  				try {
  					st = new StringTokenizer(br.readLine());
  				} catch (IOException e) {
  					e.printStackTrace();
  				}
  			}
  			return st.nextToken();
  		}
  
  		int nextInt() {
  			return Integer.parseInt(next());
  		}
  
  		long nextLong() {
  			return Long.parseLong(next());
  		}
  
  		double nextDouble() {
  			return Double.parseDouble(next());
  		}
  
  		String nextLine() {
  			String str = "";
  			try {
  				str = br.readLine();
  			} catch (IOException e) {
  				e.printStackTrace();
  			}
  			return str;
  		}
  
  		// NEXT INT ARRAY
  
  		int[] NIA(int n) {
  			int arr[] = new int[n];
  			for (int i = 0; i < n; i++)
  				arr[i] = nextInt();
  			return arr;
  		}
  
  		// NEXT DOUBLE ARRAY
  
  		double[] NDA(int n) {
  			double arr[] = new double[n];
  			for (int i = 0; i < n; i++)
  				arr[i] = nextDouble();
  			return arr;
  		}
  
  		// NEXT LONG ARRAY
  
  		long[] NLA(int n) {
  			long[] arr = new long[n];
  			for (int i = 0; i < n; i++)
  				arr[i] = nextLong();
  			return arr;
  		}
  
  		// NEXT STRING ARRAY
  
  		String[] NSA(int n) {
  			String[] arr = new String[n];
  			for (int i = 0; i < n; i++)
  				arr[i] = next();
  			return arr;
  		}
  
  		// NEXT CHARACTER ARRAY
  
  		char[] NCA(int n) {
  			char[] arr = new char[n];
  			for (int i = 0; i < n; i++)
  				arr[i] = next().charAt(0);
  			return arr;
  		}
  
  	}
  
  //*************************  FR CLASS ENDS **********************************
  
  	static long mod = (long) (1e9 + 7);
  
  	static void sort(long[] arr) {
  		ArrayList<Long> al = new ArrayList<>();
  		for (long e : arr)
  			al.add(e);
  		Collections.sort(al);
  		for (int i = 0; i < al.size(); i++)
  			arr[i] = al.get(i);
  	}
  
  	static void sort(int[] arr) {
  		ArrayList<Integer> al = new ArrayList<>();
  		for (int e : arr)
  			al.add(e);
  		Collections.sort(al);
  		for (int i = 0; i < al.size(); i++)
  			arr[i] = al.get(i);
  	}
  
  	static int UB(long[] arr, long find, int l, int r) {
  		while (l <= r) {
  			int m = (l + r) / 2;
  			if (arr[m] < find)
  				l = m + 1;
  			else
  				r = m - 1;
  		}
  		return l;
  	}
  
  	static int LB(long[] arr, long find, int l, int r) {
  		while (l <= r) {
  			int m = (l + r) / 2;
  			if (arr[m] > find)
  				r = m - 1;
  			else
  				l = m + 1;
  		}
  		return r;
  	}
  
  	static int UB(int[] arr, long find, int l, int r) {
  		while (l <= r) {
  			int m = (l + r) / 2;
  			if (arr[m] < find)
  				l = m + 1;
  			else
  				r = m - 1;
  		}
  		return l;
  	}
  
  	static int LB(int[] arr, long find, int l, int r) {
  		while (l <= r) {
  			int m = (l + r) / 2;
  			if (arr[m] > find)
  				r = m - 1;
  			else
  				l = m + 1;
  		}
  		return r;
  	}
  
  	static long gcd(long a, long b) {
  		if (b == 0)
  			return a;
  		return gcd(b, a % b);
  	}
  
  	static boolean[] prime(int num) {
  		boolean[] bool = new boolean[num];
  
  		for (int i = 0; i < bool.length; i++) {
  			bool[i] = true;
  		}
  		for (int i = 2; i < Math.sqrt(num); i++) {
  			if (bool[i] == true) {
  				for (int j = (i * i); j < num; j = j + i) {
  					bool[j] = false;
  				}
  			}
  		}
  		if (num >= 0) {
  			bool[0] = false;
  			bool[1] = false;
  		}
  
  		return bool;
  	}
  
  	static void sort(char[] arr) {
  		ArrayList<Character> al = new ArrayList<Character>();
  		for (char cc : arr)
  			al.add(cc);
  		Collections.sort(al);
  		for (int i = 0; i < arr.length; i++)
  			arr[i] = al.get(i);
  
  	}
  
  	static long[][] ncr(int n, int k) {
  		long C[][] = new long[n + 1][k + 1];
  		int i, j;
  
  		// Calculate value of Binomial
  		// Coefficient in bottom up manner
  		for (i = 0; i <= n; i++) {
  			for (j = 0; j <= Math.min(i, k); j++) {
  				// Base Cases
  				if (j == 0 || j == i)
  					C[i][j] = 1;
  
  				// Calculate value using
  				// previously stored values
  				else
  					C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % mod;
  			}
  		}
  
  		return C;
  	}
  
  	static long modInverse(long a, long m) {
  		long g = gcd(a, m);
  
  		return power(a, m - 2, m);
  
  	}
  
  	static long power(long x, long y, long m) {
  		if (y == 0)
  			return 1;
  		long p = power(x, y / 2, m) % m;
  		p = (int) ((p * (long) p) % m);
  		if (y % 2 == 0)
  			return p;
  		else
  			return (int) ((x * (long) p) % m);
  	}
  
  	/* ***************************************************************************************************************************************************/
  
  	static FR sc = new FR();
  	static StringBuilder sb = new StringBuilder();
  
  	public static void main(String args[]) throws IOException {
  
  		int tc = sc.nextInt();
  
  		while (tc-- > 0) {
  			TEST_CASE();
  		}
  		sb.setLength(sb.length() - 1);
  		System.out.println(sb);
  	}
  
  	static void TEST_CASE() throws IOException {
  		int n = sc.nextInt();
  		int[] arr = sc.NIA(n);
  		int ans = 0;
  		
  		while(!checkSorted(arr)) {
  			ans++;
  			trySort(arr, ans);
  		}
  		
  		sb.append(ans + "\n");
  	}
  	
  	public static boolean checkSorted(int [] arr) {
  		
  		for(int i = 0; i < arr.length; i++) {
  			if(arr[i] != i+1)
  				return false;
  		}
  		return true;
  		
  	}
  	
  	public static void trySort(int [] arr, int ans) {
  		
  		if(ans % 2 != 0) {
  			int i = 0;
  			while(i+1 < arr.length) {
  				
  				if(arr[i] >  arr[i+1]) {
  					int t = arr[i];
  					arr[i] = arr[i+1];
  					arr[i+1] = t;
  				}
  				i += 2;
  				
  			}
  		} else {
  			int i = 1;
  			while(i+1 < arr.length) {
  				
  				if(arr[i] >  arr[i+1]) {
  					int t = arr[i];
  					arr[i] = arr[i+1];
  					arr[i+1] = t;
  				}
  				i += 2;
  			}
  		}
  		
  	}
  }
  
  