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.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.InputMismatchException;
public class CGlobalRound3 {

	public static void main(String[] args) {
		FastScanner in = new FastScanner(System.in);
		
		int N = in.nextInt();
		int[] arr1 = new int[N];
		int[] arr2 = new int[N];
		
		for(int i = 0; i < N; i++) {
			arr1[i] = arr2[i] = in.nextInt() - 1;
		}
		
		int[] inverse = new int[N];
		for(int i = 0; i < N; i++) {
			inverse[arr1[i]] = i;
		}
		
		ArrayList<Pair> original = new ArrayList<>();
		for(int i = 0; i < N; i++) {
			int x = Math.min(i, inverse[i]);
			int y = Math.max(i, inverse[i]);
			
			if(x != y)
				original.add(new Pair(x, y));
			
			int a = i;
			int b = inverse[i];
			
			int ar1 = arr2[a];
			int ar2 = arr2[b];
			
			int t = arr2[a];
			arr2[a] = arr2[b];
			arr2[b] = t;
			
			t = inverse[ar1];
			inverse[ar1] = inverse[ar2];
			inverse[ar2] = t;
		}
		
		ArrayList<Pair> result = change(N, original);
		
		StringBuilder sb = new StringBuilder();
		
		sb.append(result.size());
		sb.append('\n');
		for(Pair p : result) {
			sb.append((p.a+1) + " " + (p.b+1));
			sb.append('\n');
		}
		
		System.out.println(sb.toString());
	}
	
	public static ArrayList<Pair> change(int N, ArrayList<Pair> original) {
		ArrayList<Pair> result = new ArrayList<>();
		for(Pair p : original) {
			if(valid(p.a, p.b, N)) {
				result.add(new Pair(p.a, p.b));
			}
			else {
				if(valid(p.a, 0, N) && valid(p.b, 0, N)) {
					result.add(new Pair(0, p.b));
					result.add(new Pair(0, p.a));
					result.add(new Pair(0, p.b));
				}
				else if(valid(p.a, N-1, N) && valid(p.b, N-1, N)) {
					result.add(new Pair(p.b, N-1));
					result.add(new Pair(p.a, N-1));
					result.add(new Pair(p.b, N-1));
				}
				else {
					result.add(new Pair(0, p.b));
					result.add(new Pair(0, N-1));
					result.add(new Pair(p.a, N-1));
					result.add(new Pair(0, N-1));
					result.add(new Pair(0, p.b));
				}
			}
		}
		
		for(int i = 1; i < result.size(); i++) {
			Pair p1 = result.get(i-1);
			Pair p2 = result.get(i);
			if(p1.a == p2.a && p1.b == p2.b) {
				result.remove(i);
				result.remove(i-1);
			}
		}
		
		return result;
	}
	
	public static boolean valid(int a, int b, int N) {
		return (2*(Math.abs(a-b)) >= N);
	}
	
	static class Pair {
		int a; int b;
		public Pair(int x, int y) {
			a = x; b = y;
		}
		
		public String toString() {
			return "(" + a + ", " + b + ")";
		}
	}
	
	/**
	 * 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();
		}
	}

}
/*
2
2 1
outputCopy
1
1 2
inputCopy
4
3 4 1 2
outputCopy
4
1 4
1 4
1 3
2 4
inputCopy
6
2 5 3 1 4 6
outputCopy
3
1 5
2 5
1 4
*/