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:
// Working program using Reader Class 
import java.io.*; 
import java.io.FileInputStream; 
import java.io.IOException; 
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.*; 

public class Main 
{ 
	static class Reader 
	{ 
		final private int BUFFER_SIZE = 1 << 16; 
		private DataInputStream din; 
		private byte[] buffer; 
		private int bufferPointer, bytesRead; 

		public Reader() 
		{ 
			din = new DataInputStream(System.in); 
			buffer = new byte[BUFFER_SIZE]; 
			bufferPointer = bytesRead = 0; 
		} 

		public Reader(String file_name) throws IOException 
		{ 
			din = new DataInputStream(new FileInputStream(file_name)); 
			buffer = new byte[BUFFER_SIZE]; 
			bufferPointer = bytesRead = 0; 
		} 

		public String readLine() throws IOException 
		{ 
			byte[] buf = new byte[64]; // line length 
			int cnt = 0, c; 
			while ((c = read()) != -1) 
			{ 
				if (c == '\n') 
					break; 
				buf[cnt++] = (byte) c; 
			} 
			return new String(buf, 0, cnt); 
		} 

		public int nextInt() throws IOException 
		{ 
			int ret = 0; 
			byte c = read(); 
			while (c <= ' ') 
				c = read(); 
			boolean neg = (c == '-'); 
			if (neg) 
				c = read(); 
			do
			{ 
				ret = ret * 10 + c - '0'; 
			} while ((c = read()) >= '0' && c <= '9'); 

			if (neg) 
				return -ret; 
			return ret; 
		} 

		public long nextLong() throws IOException 
		{ 
			long ret = 0; 
			byte c = read(); 
			while (c <= ' ') 
				c = read(); 
			boolean neg = (c == '-'); 
			if (neg) 
				c = read(); 
			do { 
				ret = ret * 10 + c - '0'; 
			} 
			while ((c = read()) >= '0' && c <= '9'); 
			if (neg) 
				return -ret; 
			return ret; 
		} 

		public double nextDouble() throws IOException 
		{ 
			double ret = 0, div = 1; 
			byte c = read(); 
			while (c <= ' ') 
				c = read(); 
			boolean neg = (c == '-'); 
			if (neg) 
				c = read(); 

			do { 
				ret = ret * 10 + c - '0'; 
			} 
			while ((c = read()) >= '0' && c <= '9'); 

			if (c == '.') 
			{ 
				while ((c = read()) >= '0' && c <= '9') 
				{ 
					ret += (c - '0') / (div *= 10); 
				} 
			} 

			if (neg) 
				return -ret; 
			return ret; 
		} 

		private void fillBuffer() throws IOException 
		{ 
			bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE); 
			if (bytesRead == -1) 
				buffer[0] = -1; 
		} 

		private byte read() throws IOException 
		{ 
			if (bufferPointer == bytesRead) 
				fillBuffer(); 
			return buffer[bufferPointer++]; 
		} 

		public void close() throws IOException 
		{ 
			if (din == null) 
				return; 
			din.close(); 
		} 
	} 
	 
	public static int gcd(int a, int b) 
    { 
        // Everything divides 0  
        if (a == 0 || b == 0) 
           return 0; 
       
        // base case 
        if (a == b) 
            return a; 
       
        // a is greater 
        if (a > b) 
            return gcd(a-b, b); 
        return gcd(a, b-a); 
    } 
	
	public static class Pair{
		int a;
		int b;
		Pair(int ai,int bi){
			a=ai;
			b=bi;
		}
	}

	public static void main(String[] args) throws IOException 
	{ 
		//Reader scan=new Reader(); 
		Reader scan=new Reader();
		PrintWriter out=new PrintWriter(System.out);
		int n=scan.nextInt();
		ArrayList<Pair> ans=new ArrayList<Pair>();
		HashMap<Integer,Integer> hm=new HashMap<Integer,Integer>();
		int[] a=new int[n];
		for(int i=0;i<n;i++) {
			a[i]=scan.nextInt();
			hm.put(a[i], i);
		}
		for(int i=1;i<=n/2;i++) {
			if(hm.get(i)<n/2) {
				int temp1=a[n-1];
				a[hm.get(i)]=temp1;
				ans.add(new Pair(n,hm.get(i)+1));
				a[n-1]=i;
				hm.put(temp1, hm.get(i));
				hm.put(i, n-1);
				temp1=a[0];
				ans.add(new Pair(n,1));
				a[n-1]=temp1;
				hm.put(temp1, n-1);
				a[0]=i;
				hm.put(i, 0);
				temp1=a[n/2+i-1];
				ans.add(new Pair(1,n/2+i));
				a[0]=temp1;
				a[n/2+i-1]=i;
				hm.put(temp1, 0);
				hm.put(i, n/2+i-1);
			}
			else {
				int temp=a[0];
				a[hm.get(i)]=temp;
				a[0]=i;
				ans.add(new Pair(hm.get(i)+1,1));
				hm.put(temp, hm.get(i));
				hm.put(i, 0);
				temp=a[n/2+i-1];
				ans.add(new Pair(1,n/2+i));
				a[0]=temp;
				a[n/2+i-1]=i;
				hm.put(temp, 0);
				hm.put(i, n/2+i-1);
			}
		}
		for(int i=0;i<n/2;) {
			if(a[i]==n/2+1+i) {
				i++;
				continue;
			}
			int val=a[i];
			int temp1=a[val-1];
			a[val-1]=val;
			a[i]=temp1;
			ans.add(new Pair(val,i+1));
			int temp2=a[val-n/2-1];
			a[val-n/2-1]=val;
			a[val-1]=temp2;
			ans.add(new Pair(val-n/2,val));
			a[val-1]=temp1;
			a[i]=temp2;
			ans.add(new Pair(val,i+1));
		}
		for(int i=0;i<n/2;i++) {
			int temp=a[i];
			a[i]=a[n/2+i];
			a[n/2+i]=temp;
			ans.add(new Pair(i+1,n/2+i+1));
		}
//		for(int i=0;i<a.length;i++) {
//			out.print(a[i]+" ");
//		}
//		out.println();
		out.println(ans.size());
		for(int i=0;i<ans.size();i++) {
			out.println(ans.get(i).a+" "+ans.get(i).b);
		}
		out.close();
	} 
}