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.OutputStream;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.io.UncheckedIOException;
import java.util.List;
import java.nio.charset.Charset;
import java.util.StringTokenizer;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.BufferedReader;
import java.io.InputStream;

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

    static class CCrazyDiamond {
        public void solve(int testNumber, LightScanner in, LightWriter out) {
            // out.setBoolLabel(LightWriter.BoolLabel.YES_NO_FIRST_UP);
            int n = in.ints();
            CCrazyDiamond.Array array;
            {
                int[] a = new int[n];
                for (int i = 0; i < n; i++) {
                    a[i] = in.ints() - 1;
                }
                array = new CCrazyDiamond.Array(a);
            }
            List<CCrazyDiamond.Swap> ans = new ArrayList<>();
            for (int i = 1; i < n - 1; i++) {
                if (array.a[i] == i) continue;

                if (i < n / 2) {
                    if (array.idx[i] >= n / 2) {
                        ans.add(array.swap(0, array.idx[i]));
                        ans.add(array.swap(0, n - 1));
                        ans.add(array.swap(i, n - 1));
                    } else {
                        ans.add(array.swap(n - 1, array.idx[i]));
                        ans.add(array.swap(n - 1, i));
                    }
                } else {
                    if (array.idx[i] < n / 2) {
                        ans.add(array.swap(n - 1, array.idx[i]));
                        ans.add(array.swap(n - 1, 0));
                        ans.add(array.swap(0, i));
                    } else {
                        ans.add(array.swap(0, array.idx[i]));
                        ans.add(array.swap(0, i));
                    }
                }
            }
            if (array.a[0] == n - 1 && array.a[n - 1] == 0) {
                ans.add(array.swap(0, n - 1));
            }

            out.ans(ans.size()).ln();
            //System.out.println(Arrays.toString(a));
            for (CCrazyDiamond.Swap swap : ans) {
                out.ans(swap.i + 1).ans(swap.j + 1).ln();
            }
        }

        private static class Array {
            int n;
            int[] a;
            int[] idx;

            Array(int[] a) {
                this.n = a.length / 2;
                this.a = a;
                this.idx = new int[a.length];
                for (int i = 0; i < a.length; i++) {
                    idx[a[i]] = i;
                }
            }

            CCrazyDiamond.Swap swap(int i, int j) {
                int v = a[i];
                a[i] = a[j];
                a[j] = v;
                idx[a[j]] = j;
                idx[a[i]] = i;
                return new CCrazyDiamond.Swap(i, j);
            }

        }

        private static class Swap {
            int i;
            int j;

            public Swap(int i, int j) {
                this.i = i;
                this.j = j;
            }

        }

    }

    static class LightScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public LightScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

        public String string() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new UncheckedIOException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int ints() {
            return Integer.parseInt(string());
        }

    }

    static class LightWriter implements AutoCloseable {
        private final Writer out;
        private boolean autoflush = false;
        private boolean breaked = true;

        public LightWriter(Writer out) {
            this.out = out;
        }

        public LightWriter(OutputStream out) {
            this(new BufferedWriter(new OutputStreamWriter(out, Charset.defaultCharset())));
        }

        public LightWriter print(char c) {
            try {
                out.write(c);
                breaked = false;
            } catch (IOException ex) {
                throw new UncheckedIOException(ex);
            }
            return this;
        }

        public LightWriter print(String s) {
            try {
                out.write(s, 0, s.length());
                breaked = false;
            } catch (IOException ex) {
                throw new UncheckedIOException(ex);
            }
            return this;
        }

        public LightWriter ans(String s) {
            if (!breaked) {
                print(' ');
            }
            return print(s);
        }

        public LightWriter ans(int i) {
            return ans(Integer.toString(i));
        }

        public LightWriter ln() {
            print(System.lineSeparator());
            breaked = true;
            if (autoflush) {
                try {
                    out.flush();
                } catch (IOException ex) {
                    throw new UncheckedIOException(ex);
                }
            }
            return this;
        }

        public void close() {
            try {
                out.close();
            } catch (IOException ex) {
                throw new UncheckedIOException(ex);
            }
        }

    }
}