Problem: You are given a permutation p of integers from 1 to n, where n is an even number. 

Your goal is to sort the permutation. To do so, you can perform zero or more operations of the following type: 

  * take two indices i and j such that 2 ⋅ |i - j| ≥ n and swap p_i and p_j. 



There is no need to minimize the number of operations, however you should use no more than 5 ⋅ n operations. One can show that it is always possible to do that.

Input

The first line contains a single integer n (2 ≤ n ≤ 3 ⋅ 10^5, n is even) — the length of the permutation. 

The second line contains n distinct integers p_1, p_2, …, p_n (1 ≤ p_i ≤ n) — the given permutation.

Output

On the first line print m (0 ≤ m ≤ 5 ⋅ n) — the number of swaps to perform.

Each of the following m lines should contain integers a_i, b_i (1 ≤ a_i, b_i ≤ n, |a_i - b_i| ≥ n/2) — the indices that should be swapped in the corresponding swap.

Note that there is no need to minimize the number of operations. We can show that an answer always exists.

Examples

Input


2
2 1


Output


1
1 2

Input


4
3 4 1 2


Output


4
1 4
1 4
1 3
2 4


Input


6
2 5 3 1 4 6


Output


3
1 5
2 5
1 4

Note

In the first example, when one swap elements on positions 1 and 2, the array becomes sorted.

In the second example, pay attention that there is no need to minimize number of swaps.

In the third example, after swapping elements on positions 1 and 5 the array becomes: [4, 5, 3, 1, 2, 6]. After swapping elements on positions 2 and 5 the array becomes [4, 2, 3, 1, 5, 6] and finally after swapping elements on positions 1 and 4 the array becomes sorted: [1, 2, 3, 4, 5, 6].

Solution (in JAVA):

Solution:
//package testing;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.util.*;

public class Main {
	static public class Pair{
		long a,b,c;
		public Pair(long a,long b,long c) {
			this.a = a;
			this.b = b;
			this.c = c;
		}
	}
	static class cmp implements Comparator<Pair>{
		public int compare(Pair p,Pair q) {
			if(p.a*p.a*p.b<q.a*q.b*q.a) {
				return -1;
			}
			return 1;
		}
	}
	static int mxn = 300005;
	static int arr[] = new int [mxn];
	static int index[]=new int [mxn];
	static ArrayList<Pair>ans = new ArrayList<>();
	static void swap(int i,int j) {
		ans.add(new Pair(i,j,0));
		int temp  = arr[i];
		arr[i] = arr[j];
		arr[j] = temp;
		index[arr[i]] = i;
		index[arr[j]] = j;
	}
	public static void main(String[] args) {
		FastScanner fs = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
//		Scanner sc = new Scanner(System.in);
		int test = 1;
//		test = fs.nextInt();
		outer:
//			6
//			2 5 3 1 4 6

		while(test-->0) {
		   int n = fs.nextInt();
		   for(int i=0;i<n;i++) {
			   arr[i] = fs.nextInt();
			   arr[i]-=1;
			   index[arr[i]] = i;
		   }

		   for(int i=0;i<n;i++) {
			   ///find the i;
			   int index_of_i = index[i];
			   if(index_of_i==i) {
//				   continue;
			   }
			   else if(Math.abs(index_of_i-i)*2>=n) {
				   swap(i,index_of_i);
			   }
			   else {
//				   1 5 3 2 4 6
				   if(Math.abs(index_of_i-0)*2>=n) {
					   swap(index_of_i,0);
					   if(Math.abs(i-0)*2>=n) {
						   swap(0,i);
					   }
					   else {
						   swap(0,n-1);
						   swap(n-1,i);
					   }
					   swap(index_of_i,0);   
				   }
				   else {
					   swap(index_of_i,n-1);
					   if(Math.abs(n-1-i)*2>=n) {
						   swap(n-1,i);
					   }
					   else {
						   swap(n-1,0);
						   swap(0,i);
						   swap(n-1,0);
					   }
					   
				   }
			   }
		   }
//		   1 5 3 2 4 6
//		   2 5 3 1 4 6
//		   6 5 3 1 4 2
//		   6 2 3 1 4 5
//		   1 2 3 6 4 5
//		   4 2 3 6 1 5
		   
		   
		   
		   for(int i=0;i<n;i++) {
			   if(i!=arr[i]) {
				   out.println("fuck");
			   }
		   }
		   out.println(ans.size());
		   for(int i=0;i<ans.size();i++) {
			   out.println((ans.get(i).a+1)+" "+(ans.get(i).b+1));
		   }	
		   
		   
		   
		}
		out.close();
	}

	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
 
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
 
		int nextInt() {
			return Integer.parseInt(next());
		}
 
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++)
				a[i]=nextInt();
			return a;
		}
 
		long nextLong() {
			return Long.parseLong(next());
		}
	}

}