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.lang.*;
    import java.math.*;
    import java.util.*;
    import java.io.*;
    public class Main {
    class Node {
        int a;
        int b;
        public Node(int a,int b){
            this.a=a;
            this.b=b;
        }
    }
        void solve(){
             n=ni();
            pos=new int[n+1];
            a=new int[n+1];
            for(int i=1;i<=n;i++){
                a[i]=ni();
                pos[a[i]]=i;
            }

            for(int i=1;i<=n;i++){
                if(pos[i]==i) continue;

                if(check(i,pos[i])){
                    swap(i,pos[i]);
                    continue;
                }

                if(check(1,pos[i])){
                    swap(1,pos[i]);
                    if(check(1,i)){
                        swap(1,i);
                    }else {
                        swap(1,n);
                        swap(n,i);
                    }
                }else {
                    swap(n,pos[i]);
                    if(check(n,i)){
                        swap(n,i);
                    }else {
                        swap(1,n);
                        swap(1,i);
                    }
                }
            }
            pw.println(vec.size());
            for(Node p : vec) pw.println(p.a+" "+p.b);


    }
    int a[];
    int n;
    int pos[];
    ArrayList<Node> vec=new ArrayList<>();
    void swap(int i,int j){

        vec.add(new Node(i,j));
        pos[a[i]]=j;
        pos[a[j]]=i;
        int tmp=a[i]; a[i]=a[j]; a[j]=tmp;


    }

    boolean check(int i,int j){
        return Math.abs(i-j)*2>=n;
    }


        long M =(long)1e9+7;


        InputStream is;
        PrintWriter pw;
        String INPUT = "";

        void run() throws Exception {
            is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
            pw = new PrintWriter(System.out);
            long s = System.currentTimeMillis();
            solve();
            pw.flush();
            if (!INPUT.isEmpty()) tr(System.currentTimeMillis() - s + "ms");


        }

        public static void main(String[] args) throws Exception {
            new Main().run();
        }

        private byte[] inbuf = new byte[1024];
        public int lenbuf = 0, ptrbuf = 0;

        private int readByte() {
            if (lenbuf == -1) throw new InputMismatchException();
            if (ptrbuf >= lenbuf) {
                ptrbuf = 0;
                try {
                    lenbuf = is.read(inbuf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (lenbuf <= 0) return -1;
            }
            return inbuf[ptrbuf++];
        }

        private boolean isSpaceChar(int c) {
            return !(c >= 33 && c <= 126);
        }

        private int skip() {
            int b;
            while ((b = readByte()) != -1 && isSpaceChar(b)) ;
            return b;
        }

        private double nd() {
            return Double.parseDouble(ns());
        }

        private char nc() {
            return (char) skip();
        }

        private String ns() {
            int b = skip();
            StringBuilder sb = new StringBuilder();
            while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }

        private char[] ns(int n) {
            char[] buf = new char[n];
            int b = skip(), p = 0;
            while (p < n && !(isSpaceChar(b))) {
                buf[p++] = (char) b;
                b = readByte();
            }
            return n == p ? buf : Arrays.copyOf(buf, p);
        }

        private char[][] nm(int n, int m) {
            char[][] map = new char[n][];
            for (int i = 0; i < n; i++) map[i] = ns(m);
            return map;
        }

        private int[] na(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = ni();
            return a;
        }

        private int ni() {
            int num = 0, b;
            boolean minus = false;
            while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
            if (b == '-') {
                minus = true;
                b = readByte();
            }

            while (true) {
                if (b >= '0' && b <= '9') {
                    num = num * 10 + (b - '0');
                } else {
                    return minus ? -num : num;
                }
                b = readByte();
            }
        }

        private long nl() {
            long num = 0;
            int b;
            boolean minus = false;
            while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
            if (b == '-') {
                minus = true;
                b = readByte();
            }

            while (true) {
                if (b >= '0' && b <= '9') {
                    num = num * 10 + (b - '0');
                } else {
                    return minus ? -num : num;
                }
                b = readByte();
            }
        }

        private boolean oj = System.getProperty("ONLINE_JUDGE") != null;

        private void tr(Object... o) {
            if (INPUT.length() > 0) System.out.println(Arrays.deepToString(o));
        }

    }