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:
import java.util.*;
import java.io.*;

public class global3c {
	
	static class Tuple<X, Y> { 
		  public final X x; 
		  public final Y y; 
		  public Tuple(X x, Y y) { 
		    this.x = x; 
		    this.y = y; 
		  } 
		  public String toString() {
			  return "("+ x + "," + y + ")";
		  }
	} 
	
	public static ArrayList<Integer> stepsX;
	public static ArrayList<Integer> stepsY;

	public static void main(String args[]) {
		stepsX = new ArrayList<>();
		stepsY = new ArrayList<>();
		
		FastScanner in = new FastScanner(System.in);
		int n = in.nextInt();
		int[] arr = new int[n];
		HashMap<Integer, Integer> dict = new HashMap<>();
		for (int i = 0; i < n; i++) {
			arr[i] = in.nextInt();
			dict.put(arr[i], i);
		}
		ArrayList<Tuple<Integer, Integer>> steps = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			int val = i+1;
			int index1 = dict.get(val);
			int index2 = i;
			int val2 = arr[i];
			if (Math.abs(index2 - index1) >= n/2) {
				//System.out.println("swap1");
				swap1(arr, index1, index2, steps);
			}
			else if ((index1 < n/2 && index2<n/2) || (index1 >= n/2 && index2 >= n/2)) {
				//System.out.println("swap2");
				swap2(arr, index1, index2, steps);
			}
			else {
				//System.out.println("swap3");
				swap3(arr, index1, index2, steps);
			}
			dict.put(val, index2);
			dict.put(val2, index1);
		}
		//System.out.println(steps.size());
		/*for (Tuple<Integer, Integer> step : steps) {
			System.out.println((step.x + 1) + " " + (step.y+1));
		}*/
		int len = stepsX.size();
		StringBuilder sb = new StringBuilder();
		System.out.println(len);
		for (int i = 0 ; i < len; i++) {
			sb.append((stepsX.get(i)+1) + " " + (stepsY.get(i)+1) + "\n");
		}
		System.out.println(sb);
	}
	
	private static void swap(int[] arr, int x, int y) {
		int temp = arr[x];
		arr[x] = arr[y];
		arr[y] = temp;
		stepsX.add(x);
		stepsY.add(y);
	}
	
	private static void swap1(int[] arr, int x, int y, ArrayList<Tuple<Integer, Integer>> steps) {
		if (x==y) return;
		swap(arr, x,y);
		//steps.add(new Tuple(x, y));
	}
	
	private static void swap2(int[] arr, int x, int y, ArrayList<Tuple<Integer, Integer>> steps) {
		if (x==y) return;
		if (x < arr.length/2) {
			swap(arr, x, arr.length-1);
			swap(arr, y, arr.length-1);
			swap(arr, x, arr.length-1);
			/*steps.add(new Tuple(x, arr.length-1));
			steps.add(new Tuple(y, arr.length-1));
			steps.add(new Tuple(x, arr.length-1));*/
		}
		else {
			swap(arr, x, 0);
			swap(arr, y, 0);
			swap(arr, x, 0);
			/*steps.add(new Tuple(x, 0));
			steps.add(new Tuple(y, 0));
			steps.add(new Tuple(x, 0));*/
		}
	}
	
	private static void swap3(int[] arr, int x, int y, ArrayList<Tuple<Integer, Integer>> steps) {
		if (x==y) return;
		if (x<arr.length/2) {
			swap(arr, x, arr.length-1);
			swap(arr, y, 0);
			swap(arr, 0, arr.length-1);
			swap(arr, x, arr.length-1);
			swap(arr, y, 0);
			/*steps.add(new Tuple(x, arr.length-1));
			steps.add(new Tuple(y, 0));
			steps.add(new Tuple(0, arr.length-1));
			steps.add(new Tuple(x, arr.length-1));
			steps.add(new Tuple(y, 0));*/
		}
		else {
			swap(arr, y, arr.length-1);
			swap(arr, x, 0);
			swap(arr, 0, arr.length-1);
			swap(arr, y, arr.length-1);
			swap(arr, x, 0);
			/*steps.add(new Tuple(y, arr.length-1));
			steps.add(new Tuple(x, 0));
			steps.add(new Tuple(0, arr.length-1));
			steps.add(new Tuple(y, arr.length-1));
			steps.add(new Tuple(x, 0));*/
		}
	}
	
	/**
	 * Source: Matt Fontaine
	 */
	static class FastScanner {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int chars;

		public FastScanner(InputStream stream) {
			this.stream = stream;
		}

		int read() {
			if (chars == -1)
				throw new InputMismatchException();
			if (curChar >= chars) {
				curChar = 0;
				try {
					chars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (chars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		boolean isEndline(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public String next() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public String nextLine() {
			int c = read();
			while (isEndline(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndline(c));
			return res.toString();
		}
	}

}