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: import java.io.IOException;
  import java.io.InputStreamReader;
  import java.io.PrintWriter;
  import java.util.StringTokenizer;
  import java.io.BufferedReader;
  import java.util.*;
  
  public class A {
  	private static final FastReader fs = new FastReader();
  	private static final PrintWriter out = new PrintWriter(System.out);
  	private static long m = 1_000_000_009;
  	private static long p = 31;
  	private static long mod = 1_000_000_007;
  	
  	
  	private static void solve() throws Exception {
  		int n = fs.nextInt();
  		int[] a = fs.readintarray(n);
  		int itr = 0;
  		while(true) {
  			boolean isSorted = true;
  			int[] clone = a.clone();
  			Arrays.sort(clone);
  			for(int i = 0; i < n; i++)
  				if(clone[i] != a[i]) {
  					isSorted = false;
  					break;
  				}
  			if(isSorted)
  				break;
  			if((itr + 1) % 2 == 0) {
  				for(int i = 1; i <= n-2; i+=2)
  					if(a[i] > a[i+1]) {
  						int t = a[i];
  						a[i] = a[i+1];
  						a[i+1] = t;
  					}
  			}else {
  				for(int i = 0; i <= n-3; i+=2)
  					if(a[i] > a[i+1]) {
  						int t = a[i];
  						a[i] = a[i+1];
  						a[i+1] = t;
  					}
  			}
  			itr += 1;
  		}
  		out.println(itr);
  	}
   
  	public static void main(String[] args) {
  		Thread t = new Thread(null, null, "", 1 << 28) {
  			public void run() {
  				int test_case = 1;
  				test_case = fs.nextInt();
  				for (int cs = 1; cs <= test_case; cs++) {
  					try {
  						solve();
  					} catch (Exception e) {
  						// TODO Auto-generated catch block
  						e.printStackTrace();
  					}
  				}
  				out.close();
  			}
  		};
  		t.start();
  		try {
  			t.join();
  		} catch (InterruptedException e) {
  			e.printStackTrace();
  		}
  	}
   
  	private static class FastReader {
  		BufferedReader br;
  		StringTokenizer st;
   
  		public FastReader() {
  			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;
  		}
   
  		int[] readintarray(int n) {
  			int res[] = new int[n];
  			for (int i = 0; i < n; i++)
  				res[i] = nextInt();
  			return res;
  		}
   
  		long[] readlongarray(int n) {
  			long res[] = new long[n];
  			for (int i = 0; i < n; i++)
  				res[i] = nextLong();
  			return res;
  		}
  	}
   
  	public static class pair<T1 extends Comparable<T1>, T2 extends Comparable<T2>> implements Comparable<pair<T1, T2>> {
  		T1 ff;
  		T2 ss;
   
  		public pair(T1 ff, T2 ss) {
  			this.ff = ff;
  			this.ss = ss;
  		}
   
  		public int compareTo(pair<T1, T2> o) {
  			if (ff == o.ff)
  				return ss.compareTo(o.ss);
  			return ff.compareTo(o.ff);
  		}
  	}
  	
  	private static int max(int... arg) throws Exception {
  		int length = arg.length;
  		if(length == 0)
  			throw new Exception("Exception from maxFunction with Integer return type. Reason is :: Argument length cannot be zero");
  		int maxVal = arg[0];
  		for(int i = 1; i < length; i++)
  			maxVal = Math.max(maxVal, arg[i]);
  		return maxVal;
  	}
  	
  	private static int min(int... arg) throws Exception {
  		int length = arg.length;
  		if(length == 0)
  			throw new Exception("Exception from minFunction with Integer return type. Reason is :: Argument length cannot be zero");
  		int maxVal = arg[0];
  		for(int i = 1; i < length; i++)
  			maxVal = Math.min(maxVal, arg[i]);
  		return maxVal;
  	}
  	
  	private static long max(long... arg) throws Exception {
  		int length = arg.length;
  		if(length == 0)
  			throw new Exception("Exception from maxFunction with Long return type. Reason is :: Argument length cannot be zero");
  		long maxVal = arg[0];
  		for(int i = 1; i < length; i++)
  			maxVal = Math.max(maxVal, arg[i]);
  		return maxVal;
  	}
  	
  	private static long min(long... arg) throws Exception {
  		int length = arg.length;
  		if(length == 0)
  			throw new Exception("Exception from minFunction with Long return type. Reason is :: Argument length cannot be zero");
  		long maxVal = arg[0];
  		for(int i = 1; i < length; i++)
  			maxVal = Math.min(maxVal, arg[i]);
  		return maxVal;
  	}
  	
  	private static int abs(int a) {
  		return a >= 0 ? a : -a;
  	}
  	
  	private static int abs(int a, int b) {
  		return a-b >= 0 ? a-b : b-a;
  	}
  	
  	private static long abs(long a) {
  		return a >= 0 ? a : -a;
  	}
  	
  	private static long abs(long a, long b) {
  		return a-b >= 0 ? a-b : b-a;
  	}
  	
  	private static int power(int base, int exponent) {
  		int res = 1;
  		while(exponent > 0) {
  			if((exponent & 1) != 0)
  				res *= base;
  			exponent >>= 1;
  			base *= base;
  		}
  		return res;
  	}
  	
  	private static long power(long base, long exponent) {
  		long res = 1;
  		while(exponent > 0) {
  			if((exponent & 1) != 0)
  				res *= base;
  			exponent >>= 1;
  			base *= base;
  		}
  		return res;
  	}
  	
  	private static long mPower(long base, long exponent) throws Exception {
  		long res = 1;
  		base %= mod;
  		while(exponent > 0) {
  			if((exponent & 1) != 0)
  				res = mul(res, base);
  			exponent >>= 1;
  			base = mul(base, base);
  		}
  		return res;
  	}
  	
  	private static long mul(long... arg) throws Exception {
  		long mulRes = 1;
  		for(long arg0 : arg)
  			mulRes = (mulRes % mod * arg0 % mod) % mod;
  		return mulRes;
  	}
  	
  	private static long add(long... arg) throws Exception {
  		long mulRes = 1;
  		for(long arg0 : arg)
  			mulRes = (mulRes % mod + arg0 % mod) % mod;
  		return mulRes;
  	}
  	
  	private static long sub(long... arg) throws Exception {
  		long mulRes = 1;
  		for(long arg0 : arg)
  			mulRes = ((mulRes % mod - arg0 % mod) % mod + mod) % mod;
  		return mulRes;
  	}
  }