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.io.*;
import java.text.*;
public class Main{
    //SOLUTION BEGIN
    //Spread AC, not hacks
    void pre() throws Exception{}
    void solve(int TC) throws Exception{
        int n = ni();
        int[] p = new int[n], ind = new int[n];
        for(int i = 0; i< n; i++){p[i] = ni()-1;ind[p[i]] = i;}
        int[][] op = new int[5*n][];int cnt = 0;
        for(int i = 0; i< n; i++){
            int a = i, b = ind[i];
            hold(a<=b);
            if(a==b)continue;
            if(b-a>=n/2)swap(op, cnt++, p, ind, a, b);
            else{
                if(b< n/2){
                    if(swap(op, cnt, p, ind, a, n-1))cnt++;
                    if(swap(op, cnt, p, ind, b, n-1))cnt++;
                    if(swap(op, cnt, p, ind, a, n-1))cnt++;
                }else if(a< n/2){
                    if(swap(op, cnt, p, ind, a, n-1))cnt++;
                    if(swap(op, cnt, p, ind, 0, n-1))cnt++;
                    if(swap(op, cnt, p, ind, 0, b))cnt++;
                    if(swap(op, cnt, p, ind, 0, n-1))cnt++;
                    if(swap(op, cnt, p, ind, a, n-1))cnt++;
                }else{
                    if(swap(op, cnt, p, ind, a, 0))cnt++;
                    if(swap(op, cnt, p, ind, b, 0))cnt++;
                    if(swap(op, cnt, p, ind, a, 0))cnt++;
                }
            }
        }
        pn(cnt);
        for(int i = 0; i< cnt; i++)pn(op[i][0]+" "+op[i][1]);
    }
    int[] check(int[] pp, int[][] op){
        int[] p = Arrays.copyOfRange(pp, 0, pp.length);
        for(int[] i:op){
            int ix = i[0]-1, iy = i[1]-1;
            int tmp = p[ix];
            p[ix] = p[iy];
            p[iy] = tmp;
        }
        return p;
    }
    boolean swap(int[][] op, int c, int[] p, int[] ind, int i1, int i2){
        if(i1==i2)return false;
        int a = p[i1], b = p[i2];
        op[c] = new int[]{1+i1, 1+i2};
        p[i2] = a;p[i1] = b;
        ind[a] = i2;ind[b] = i1;
        return true;
    }
    //SOLUTION END
    void hold(boolean b)throws Exception{if(!b)throw new Exception("Hold right there, Sparky!");}
    long mod = (long)987654319, IINF = (long)1e18;
    final int INF = (int)1e9, MX = (int)2e5+5;
    DecimalFormat df = new DecimalFormat("0.00000000000");
    double PI = 3.141592653589793238462643383279502884197169399, eps = 1e-8;
    static boolean multipleTC = false, memory = true;
    FastReader in;PrintWriter out;
    void run() throws Exception{
        in = new FastReader();
        out = new PrintWriter(System.out);
        //Solution Credits: Taranpreet Singh
        int T = (multipleTC)?ni():1;
        pre();for(int t = 1; t<= T; t++)solve(t);
        out.flush();
        out.close();
    }
    public static void main(String[] args) throws Exception{
        if(memory)new Thread(null, new Runnable() {public void run(){try{new Main().run();}catch(Exception e){e.printStackTrace();}}}, "1", 1 << 28).start();
        else new Main().run();
    }
    long gcd(long a, long b){return (b==0)?a:gcd(b,a%b);}
    int gcd(int a, int b){return (b==0)?a:gcd(b,a%b);}
    int bit(long n){return (n==0)?0:(1+bit(n&(n-1)));}
    void p(Object o){out.print(o);}
    void pn(Object o){out.println(o);}
    void pni(Object o){out.println(o);out.flush();}
    String n()throws Exception{return in.next();}
    String nln()throws Exception{return in.nextLine();}
    int ni()throws Exception{return Integer.parseInt(in.next());}
    long nl()throws Exception{return Long.parseLong(in.next());}
    double nd()throws Exception{return Double.parseDouble(in.next());}

    class FastReader{
        BufferedReader br;
        StringTokenizer st;
        public FastReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public FastReader(String s) throws Exception{
            br = new BufferedReader(new FileReader(s));
        }

        String next() throws Exception{
            while (st == null || !st.hasMoreElements()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (IOException  e){
                    throw new Exception(e.toString());
                }
            }
            return st.nextToken();
        }

        String nextLine() throws Exception{
            String str = "";
            try{   
                str = br.readLine();
            }catch (IOException e){
                throw new Exception(e.toString());
            }  
            return str;
        }
    }
}