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.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.List;

public class Main {

    public static void main(String[] args) {
        if (args.length > 0 && args[0].toLowerCase().equals("local")) {
            try {
                System.setIn(new FileInputStream("input.txt"));
                System.setOut(new PrintStream(new File("output.txt")));
            } catch (IOException exc) {
            }
        }
        Task task = new Task();
        task.solve();
    }

    public static class Task {
        static final long MOD = (long) 1e9 + 7;
        static final PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));

        public void solve() {
            try {
                Scan sc = new Scan();
                int n = (int) sc.scanLong();
                int[] arr = new int[n + 1];
                int[] pos = new int[n + 1];
                for (int i = 1; i <= n; ++i) {
                    arr[i] = (int) sc.scanLong();
                    pos[arr[i]] = i;
                }
                int[] orig = arr.clone();
                List<int[]> swaps = new ArrayList<>();
                for (int i = 1; i <= n / 2; ++i) {
                    int curr = arr[i];
                    if (curr == i) {
                        continue;
                    } else {
                        int i_pos = pos[i];
                        if (i_pos > n / 2) {
                            if (i_pos - i < n / 2) {
                                swaps.add(new int[] { i_pos, 1 });
                                swaps.add(new int[] { 1, n });
                                swaps.add(new int[] { i_pos, 1 });
                                pos[i] = n;
                                pos[arr[n]] = i_pos;
                                arr[i_pos] = arr[n];
                                arr[n] = i;
                                i_pos = n;
                            }
                            swaps.add(new int[] { i_pos, i });
                            pos[i] = i;
                            pos[curr] = i_pos;
                            arr[i_pos] = curr;
                            arr[i] = i;
                        } else {
                            swaps.add(new int[] { i_pos, n });
                            swaps.add(new int[] { n, i });
                            pos[i] = i;
                            pos[arr[n]] = i_pos;
                            pos[curr] = n;
                            arr[i] = i;
                            arr[i_pos] = arr[n];
                            arr[n] = curr;
                        }
                    }
                }

                for (int i = 1 + n / 2; i <= n; ++i) {
                    int curr = arr[i];
                    if (curr == i) {
                        continue;
                    } else {
                        int i_pos = pos[i];
                        swaps.add(new int[] { i_pos, 1 });
                        swaps.add(new int[] { 1, i });
                        swaps.add(new int[] { i_pos, 1 });
                        pos[i] = i;
                        pos[curr] = i_pos;
                        arr[i] = i;
                        arr[i_pos] = curr;
                    }
                }
                out.println(swaps.size());
                for (int[] swap : swaps) {
                    orig[swap[0]] ^= orig[swap[1]];
                    orig[swap[1]] ^= orig[swap[0]];
                    orig[swap[0]] ^= orig[swap[1]];
                    out.println(swap[0] + " " + swap[1]);
                }

            } finally {
                out.close();
            }
        }

        private void debug(Object... x) {
            StringBuilder sb = new StringBuilder();
            for (Object o : x)
                sb.append(String.valueOf(o)).append(" ");
            out.println(sb);
        }
    }

    public static class Scan {
        private byte[] buf = new byte[1024];
        private int index;
        private InputStream in;
        private int total;

        public Scan() {
            in = System.in;
        }

        public int scan() {
            if (total < 0)
                throw new InputMismatchException();
            if (index >= total) {
                index = 0;
                try {
                    total = in.read(buf);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
                if (total <= 0)
                    return -1;
            }
            return buf[index++];
        }

        public long scanLong() {
            long integer = 0;
            int n = scan();
            while (isWhiteSpace(n))
                n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    integer *= 10;
                    integer += n - '0';
                    n = scan();
                } else
                    throw new InputMismatchException();
            }
            return neg * integer;
        }

        public double scanDouble() {
            double doub = 0;
            int n = scan();
            while (isWhiteSpace(n))
                n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n) && n != '.') {
                if (n >= '0' && n <= '9') {
                    doub *= 10;
                    doub += n - '0';
                    n = scan();
                } else
                    throw new InputMismatchException();
            }
            if (n == '.') {
                n = scan();
                double temp = 1;
                while (!isWhiteSpace(n)) {
                    if (n >= '0' && n <= '9') {
                        temp /= 10;
                        doub += (n - '0') * temp;
                        n = scan();
                    } else
                        throw new InputMismatchException();
                }
            }
            return doub * neg;
        }

        public String scanString() {
            StringBuilder sb = new StringBuilder();
            int n = scan();
            while (isWhiteSpace(n))
                n = scan();
            while (!isWhiteSpace(n)) {
                sb.append((char) n);
                n = scan();
            }
            return sb.toString();
        }

        public char scanChar() {
            int n = scan();
            while (isWhiteSpace(n))
                n = scan();
            return (char) n;
        }

        private boolean isWhiteSpace(int n) {
            if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1)
                return true;
            return false;
        }
    }
}