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: 					/*
  					ID: abdelra29
  LANG: JAVA
  PROG: zerosum
  					*/
  						/*
  						TO LEARN
  				
  						2-euler tour
  					
  						*/
  						/*
  						TO SOLVE 
  						*/
  						/*
  						bit manipulation shit
  						1-Computer Systems: A Programmer's Perspective
  						2-hacker's delight
  						*/
  						/*
  						TO WATCH
  						
  						*/
  						            import java.util.*;
  								    import java.math.*;
  								    import java.io.*; 
  								    import java.util.stream.Collectors;
  
  								       public class A{
  						            static FastScanner scan=new FastScanner();
  									     public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
  static int arr[];
  static boolean issorted()
  {
  	for(int i=0;i<arr.length-1;i++)
  		if(arr[i]>arr[i+1])
  			return false;
  		return true;
  }
  static void f(int x)
  {
  	int st=x%2;
  	for(;st<arr.length-1;st+=2)
  	{
  		if(arr[st]>arr[st+1])
  		{
  			int tmp=arr[st];
  			arr[st]=arr[st+1];
  			arr[st+1]=tmp;
  		}
  	}
  }
  		public static void main(String[] args)  throws Exception 
  						      {
  						 /*
  						 very important tips 
  						 1-just fucking think backwards once in your shitty life
  						 2-consider brute forcing and finding some patterns and observations
  						 3-when you're in contest don't get out because you think there is no enough time
  						 4-don't get stuck on one approach 
  						 */
  						
  							//scan=new FastScanner("binary.in");
  								///out = new PrintWriter("zerosum.out");
  								 
  								 							 /*
  								 READING 
  							
  								 3-Introduction to DP with Bitmasking codefoces
  								 4-Bit Manipulation hackerearth
  								 5-read more about mobious and inculsion-exclusion 
  								 */
  								
  								
  					
  								    int tt=1;
  		tt=scan.nextInt();
  						
  							 outer:while(tt-->0)
  								    {
  								    	int n=scan.nextInt();
  								    	arr=new int[n];
  								    	for(int i=0;i<n;i++)
  								    		arr[i]=scan.nextInt();
  								    	int res=0;
  								    		for(int i=0;i<n;i++)
  								    		{
  								    			if(issorted())
  								    			{
  								    				out.println(res);
  								    				continue outer;
  								    			}
  								    			res++;
  								    			f(i);
  								    		}
  								    		out.println(res);
  								    	
  								    	
  								  
  
  
  
  				    	
  								    	
  	 }
  
  								
  
  		out.close();
  					}
  					
  
  					static class special{
  					boolean is;
  					char c;
  					public special(boolean is,char c)
  					{
  						this.is=is;
  						this.c=c;
  					}
  
  						 @Override
  								            public int hashCode() {
  								                return (int)(c+ 31 *(is?1:0));
  								            }
  						  @Override
  								            public boolean equals(Object o){
  								            //	System.out.println("FUCK");
  								                if (o == this) return true;
  								                if (o.getClass() != getClass()) return false;
  								                special t = (special)o;
  								                return t.is == is && t.c == c;
  								            }
  					}
  		
  								   
  								     static long binexp(long a,long n)
  								    {
  								        if(n==0)
  								            return 1;
  								        long res=binexp(a,n/2);
  								        if(n%2==1)
  								            return res*res*a;
  								        else 
  								            return res*res;
  								    }
  								     
  								    static long powMod(long base, long exp, long mod) {
  								           if (base == 0 || base == 1) return base;
  								           if (exp == 0) return 1;
  								           if (exp == 1) return (base % mod+mod)%mod;
  								           long R = (powMod(base, exp/2, mod) % mod+mod)%mod;
  								           R *= R;
  								           R %= mod;
  								           if ((exp & 1) == 1) {
  								               return (base * R % mod+mod)%mod;
  								           }
  								           else return (R %mod+mod)%mod;
  								       }
  								    static double dis(double x1,double y1,double x2,double y2)
  								    {
  								        return Math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
  								    }
  								    static long mod(long x,long y)
  								        {
  								            if(x<0)
  								                x=x+(-x/y+1)*y;
  								            return x%y;
  								        }
  								     public static  long pow(long b, long e) {
  								                long r = 1;
  								                while (e > 0) {
  								                    if (e % 2 == 1) r = r * b ;
  								                    b = b * b;
  								                    e >>= 1;
  								                }
  								                return r;
  								            }
  								    private static void sort(int[] arr) {
  								            List<Integer> list = new ArrayList<>();
  								            for (int object : arr) list.add(object);
  								            Collections.sort(list);
  								        //Collections.reverse(list);
  								            for (int i = 0; i < list.size(); ++i) arr[i] = list.get(i);
  								        }
  								    private static void sort2(long[] arr) {
  								            List<Long> list = new ArrayList<>();
  								            for (Long object : arr) list.add(object);
  								            Collections.sort(list);
  								        Collections.reverse(list);
  								            for (int i = 0; i < list.size(); ++i) arr[i] = list.get(i);
  								        }
  								     static class FastScanner
  						{
  						    private int BS = 1 << 16;
  						    private char NC = (char) 0;
  						    private byte[] buf = new byte[BS];
  						    private int bId = 0, size = 0;
  						    private char c = NC;
  						    private double cnt = 1;
  						    private BufferedInputStream in;
  						 
  						    public FastScanner() {
  						        in = new BufferedInputStream(System.in, BS);
  						    }
  						 
  						    public FastScanner(String s) {
  						        try {
  						            in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
  						        } catch (Exception e) {
  						            in = new BufferedInputStream(System.in, BS);
  						        }
  						    }
  						 
  						    private char getChar() {
  						        while (bId == size) {
  						            try {
  						                size = in.read(buf);
  						            } catch (Exception e) {
  						                return NC;
  						            }
  						            if (size == -1) return NC;
  						            bId = 0;
  						        }
  						        return (char) buf[bId++];
  						    }
  						 
  						    public int nextInt() {
  						        return (int) nextLong();
  						    }
  						 
  						    public int[] nextInts(int N) {
  						        int[] res = new int[N];
  						        for (int i = 0; i < N; i++) {
  						            res[i] = (int) nextLong();
  						        }
  						        return res;
  						    }
  						 
  						    public long[] nextLongs(int N) {
  						        long[] res = new long[N];
  						        for (int i = 0; i < N; i++) {
  						            res[i] = nextLong();
  						        }
  						        return res;
  						    }
  						 
  						    public long nextLong() {
  						        cnt = 1;
  						        boolean neg = false;
  						        if (c == NC) c = getChar();
  						        for (; (c < '0' || c > '9'); c = getChar()) {
  						            if (c == '-') neg = true;
  						        }
  						        long res = 0;
  						        for (; c >= '0' && c <= '9'; c = getChar()) {
  						            res = (res << 3) + (res << 1) + c - '0';
  						            cnt *= 10;
  						        }
  						        return neg ? -res : res;
  						    }
  						 
  						    public double nextDouble() {
  						        double cur = nextLong();
  						        return c != '.' ? cur : cur + nextLong() / cnt;
  						    }
  						 
  						    public double[] nextDoubles(int N) {
  						        double[] res = new double[N];
  						        for (int i = 0; i < N; i++) {
  						            res[i] = nextDouble();
  						        }
  						        return res;
  						    }
  						 
  						    public String next() {
  						        StringBuilder res = new StringBuilder();
  						        while (c <= 32) c = getChar();
  						        while (c > 32) {
  						            res.append(c);
  						            c = getChar();
  						        }
  						        return res.toString();
  						    }
  						 
  						    public String nextLine() {
  						        StringBuilder res = new StringBuilder();
  						        while (c <= 32) c = getChar();
  						        while (c != '\n') {
  						            res.append(c);
  						            c = getChar();
  						        }
  						        return res.toString();
  						    }
  						 
  						    public boolean hasNext() {
  						        if (c > 32) return true;
  						        while (true) {
  						            c = getChar();
  						            if (c == NC) return false;
  						            else if (c > 32) return true;
  						        }
  						    }
  						}
  
  								     static class Pair implements Comparable<Pair>{
  								            public long x, y,z;
  								            public Pair(long x1, long y1,long z1) {
  								                x=x1;
  								                y=y1;
  								                z=z1;
  								            }
  								             public Pair(long x1, long y1) {
  								                x=x1;
  								                y=y1;
  								    
  								            }
  								            
  								            @Override
  								            public int hashCode() {
  								                return (int)(x + 31 * y);
  								            }
  								            public String toString() {
  								                return x + " " + y+" "+z;
  								            }
  								            @Override
  								            public boolean equals(Object o){
  								                if (o == this) return true;
  								                if (o.getClass() != getClass()) return false;
  								                Pair t = (Pair)o;
  								                return t.x == x && t.y == y&&t.z==z;
  								            }
  								    public int compareTo(Pair o)
  								    {
  								  	
  								  
  								    	return (int)(x-o.x);
  								     
  								        }
  								     
  								    }
  								}
  								
  								    
  								   
  
  								     
  