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.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

/* abhi2601 */

public class Q3 implements Runnable{

    final static long mod = (long)1e9 + 7;

    static class pair{
        int i,q;
        pair(int a, int b){
            i=a;
            q=b;
        }
    }

    static class comp implements Comparator<pair>{
        public int compare(pair a,pair b){
            if(a.q<b.q) return -1;
            else if(a.q>b.q) return 1;
            return 0;
        }
    }

    public void run() {

        InputReader sc = new InputReader(System.in);
        PrintWriter w = new PrintWriter(System.out);
        int n=sc.nextInt();
        ArrayList<Integer>al=new ArrayList<>();
        int a[]=new int[n+1];
        al.add(0);
        for(int i=1;i<=n;i++){
            int q=sc.nextInt();
            al.add(q);
            a[q]=i;
        }
        ArrayList<pair>pp=new ArrayList<>();
        int ii=n/2,jj=(n/2)+1,ans=0,m=0,z=0;
        while(m<n){
            int i;
            if(z==0){
                i=ii;
                ii--;
                z=1-z;
            }
            else{
                i=jj;
                jj++;
                z=1-z;
            }
            m++;
            if(a[i]==i) continue;
            //w.println("A "+i+" "+a[i]);
            if(Math.abs(a[i]-i)>=(n/2)){
                pp.add(new pair(i,a[i]));
                ans++;
                int temp=a[i];
                a[i]=i;
                a[al.get(i)]=temp;
                al.set(temp,al.get(i));
                al.set(i,i);
            }
            else{
                if(i-1>=(n/2)){
                    if(a[i]-1<(n/2)){
                        pp.add(new pair(a[i],n));
                        ans++;
                        int temp=a[i];
                        a[i]=n;
                        a[al.get(n)]=temp;
                        al.set(temp,al.get(n));
                        al.set(n,i);
                    }
                    pp.add(new pair(1,a[i]));
                    ans++;
                    int temp=a[i];
                    a[i]=1;
                    a[al.get(1)]=temp;
                    al.set(temp,al.get(1));
                    al.set(1,i);
                }
                if(n-i>=(n/2)){
                    if(n-a[i]<n/2){
                        pp.add(new pair(1,a[i]));
                        ans++;
                        int temp=a[i];
                        a[i]=1;
                        a[al.get(1)]=temp;
                        al.set(temp,al.get(1));
                        al.set(1,i);
                    }
                    pp.add(new pair(a[i],n));
                    ans++;
                    int temp=a[i];
                    a[i]=n;
                    a[al.get(n)]=temp;
                    al.set(temp,al.get(n));
                    al.set(n,i);
                }
                pp.add(new pair(i,a[i]));
                ans++;
                int temp=a[i];
                a[i]=i;
                a[al.get(i)]=temp;
                al.set(temp,al.get(i));
                al.set(i,i);
            }
            /*w.println(i);
            for(Integer l: al) w.print(l+" ");
            w.println();
            for(int l=0;l<=n;l++) w.print(a[l]+" ");
            w.println();*/
        }
        w.println(ans);
        for(pair p: pp) w.println(p.i+" "+p.q);
        w.close();
    }

    static class InputReader {

        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;

        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 String nextLine()
        {
            BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
        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;
        }

        public long nextLong()
        {
            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 double nextDouble()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-')
            {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.')
            {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.')
            {
                c = read();
                double m = 1;
                while (!isSpaceChar(c))
                {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public String readString()
        {
            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 boolean isSpaceChar(int c)
        {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next()
        {
            return readString();
        }

        public interface SpaceCharFilter
        {
            public boolean isSpaceChar(int ch);
        }
    }

    public static void main(String args[]) throws Exception
    {
        new Thread(null, new Q3(),"cf3",1<<26).start();
    }
}