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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Vaibhav Pulastya
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CCrazyDiamond solver = new CCrazyDiamond();
        solver.solve(1, in, out);
        out.close();
    }

    static class CCrazyDiamond {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int[] p = in.nextIntArray(n);
            int[] pos = new int[n];
            for (int i = 0; i < n; i++) {
                p[i]--;
                pos[p[i]] = i;
            }
            ArrayList<Integer> s1 = new ArrayList<>();
            ArrayList<Integer> s2 = new ArrayList<>();
            for (int val = 0; val < n; val++) {
                if (Math.abs(pos[val] - val) >= n / 2) {
                    swap(p, pos, val, pos[val], s1, s2);
                } else if (Math.abs(pos[val] - val) == 0) continue;
                else {

                    int p1 = val;
                    int p2 = pos[val];
                    int p3 = (Math.abs(p2 - (n - 1)) >= n / 2) ? n - 1 : 0;

                    swap(p, pos, p2, p3, s1, s2);

                    if (Math.abs(p3 - p1) >= n / 2) {
                        swap(p, pos, p3, p1, s1, s2);
                        if (p3 == 0) {
                            swap(p, pos, p2, p3, s1, s2);
                        }
                    } else {
                        int p4 = (Math.abs(p1 - (n - 1)) >= n / 2) ? n - 1 : 0;
                        swap(p, pos, p3, p4, s1, s2);
                        swap(p, pos, p4, p1, s1, s2);
                        if (p3 == 0) {
                            swap(p, pos, p2, p3, s1, s2);
                        }
                        if (p4 == 0) {
                            swap(p, pos, p3, p4, s1, s2);
                        }
                    }
                }
            }

            int m = s1.size();
            out.println(m);
            for (int i = 0; i < m; i++) {
                out.println(s1.get(i) + " " + s2.get(i));
            }

        }

        void swap(int[] p, int[] pos, int p2, int p3, ArrayList s1, ArrayList s2) {
            int pp2 = p[p2];
            int pp3 = p[p3];

            s1.add(p2 + 1);
            s2.add(p3 + 1);

            p[p2] = pp3;
            p[p3] = pp2;
            pos[pp3] = p2;
            pos[pp2] = p3;

        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

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

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

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

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

        public int[] nextIntArray(int size) {
            int[] array = new int[size];
            for (int i = 0; i < size; i++)
                array[i] = nextInt();
            return array;
        }

    }
}