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:

//Liverpool for the win !



import java.util.*;
import java.io.*;
import java.math.*;
public class Main implements Runnable {
    @Override
    public void run() {
        FastReader fr = new FastReader();
        PrintWriter pw = new PrintWriter(System.out);
        /*

         */


        pw.flush();
        pw.close();
    }

    static class FastReader
    {
        private InputStream mIs;private byte[] buf = new byte[1024];private int curChar,numChars;public FastReader() { this(System.in); }public FastReader(InputStream is) { mIs = is;}
        public int read() {if (numChars == -1) throw new InputMismatchException();if (curChar >= numChars) {curChar = 0;try { numChars = mIs.read(buf);} catch (IOException e) { throw new InputMismatchException();}if (numChars <= 0) return -1; }return buf[curChar++];}
        public String nextLine(){int c = read();while (isSpaceChar(c)) c = read();StringBuilder res = new StringBuilder();do {res.appendCodePoint(c);c = read();}while (!isEndOfLine(c));return res.toString() ;}
        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 long l(){int c = read();while (isSpaceChar(c)) c = read();int sgn = 1;if (c == '-') { sgn = -1 ; c = read() ; }long res = 0; do{ if (c < '0' || c > '9') throw new InputMismatchException();res *= 10 ; res += c - '0' ; c = read();}while(!isSpaceChar(c));return res * sgn;}
        public int i(){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;}
        public double d() throws IOException {return Double.parseDouble(next()) ;}
        public boolean isSpaceChar(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; }
        public boolean isEndOfLine(int c) { return c == '\n' || c == '\r' || c == -1; }
        public void scanIntArr(int [] arr){ for(int li=0;li<arr.length;++li){ arr[li]=i();}}
        public void scanLongArr(long [] arr){for (int i=0;i<arr.length;++i){arr[i]=l();}}
        public void shuffle(int [] arr){ for(int i=arr.length;i>0;--i) { int r=(int)(Math.random()*i); int temp=arr[i-1]; arr[i-1]=arr[r]; arr[r]=temp; } }
    }

    public static int mod = (int) (1e9 + 7);
    static int [] indexOf;

    public static void main(String[] args) throws IOException {
        // new Thread(null,new Main(),"Anything",1<<27).start();

        FastReader fr = new FastReader();
        PrintWriter pw = new PrintWriter(System.out);
        /*
        inputCopy
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
        */
            int n=fr.i();
            LinkedList<Integer> ans=new LinkedList<>();
            int [] arr=new int[n+1];
            for(int i=1;i<=n;++i)
                arr[i]=fr.i();
            indexOf=new int[n+1];
            for(int i=1;i<arr.length;++i)
            {
                indexOf[arr[i]]=i;
            }
            //System.err.println(Arrays.toString(arr));
            //System.err.println(Arrays.toString(indexOf));
            int moves=0;
            for(int i=1;i<=n-1;++i)
            {
                if(arr[i]!=i)
                {
                    int j=indexOf[i];
                    //System.err.println("i="+i+" j="+j);
                    if(j-i>=n/2)
                    {
                        //System.err.println("i="+i+" j="+j);
                        ans.add(i);
                        ans.add(j);
                        swap(arr,i,j);
                        ++moves;
                    }
                    else
                    {
                        if(j>n/2)
                        {
                            ans.add(1);
                            ans.add(n);
                            swap(arr,1,n);

                            if(j!=n) {
                                ans.add(1);
                                ans.add(j);
                                swap(arr, 1, j);
                            }
                            else
                            {
                                moves--;
                            }

                            if(i>n/2)
                            {
                                ans.add(1);
                                ans.add(i);
                                swap(arr,1,i);

                                ans.add(1);
                                ans.add(n);
                                swap(arr,1,n);
                            }
                            else
                            {
                                ans.add(1);
                                ans.add(n);
                                swap(arr,1,n);

                                ans.add(i);
                                ans.add(n);
                                swap(arr,i,n);

                            }
                            moves+=4;
                        }
                        else
                        {
                            ans.add(j);
                            ans.add(n);
                            swap(arr,j,n);

                            ans.add(i);
                            ans.add(n);
                            swap(arr,i,n);

                            moves+=2;
                        }
                    }
                }
                //System.err.println("i="+i+Arrays.toString(arr));
            }
            //System.err.println(Arrays.toString(arr));
            pw.println(moves);
            Iterator<Integer> itr=ans.listIterator();
            while(itr.hasNext())
            {
                pw.println(itr.next()+" "+itr.next());
            }
            pw.flush();
            pw.close();
    }
    public static void swap(int [] arr,int i1,int i2)
    {
        int temp=arr[i1];
        arr[i1]=arr[i2];
        arr[i2]=temp;
        indexOf[arr[i1]]=i1;
        indexOf[arr[i2]]=i2;
        return;
    }
}