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 javax.crypto.SealedObject;
import java.io.*;
import java.util.*;

public class Third {
    public static void main(String[] args) throws Exception {
        /*new Thread(null, new Runnable() {
            @Override
            public void run() {
                try {
                    new Solver().solve();
                } catch (Exception e) {
                    e.printStackTrace();
                    System.exit(1);
                }
            }
        }, "Solver", 1l << 30).start();*/

        new Solver1().solve();
    }
}

class Solver1 {
    IO io = new IO(System.in, System.out);
    StringBuilder sb = new StringBuilder();

    int N, line;
    int[] A;

    void solve() throws Exception {
        int i, j, k;

        A = new int[N = io.nextInt()];
        for (i = 0; i < N; ++i) A[i] = io.nextInt() - 1;

        for (i = 1; i < N - 1; ++i) {
            while (A[i] != i) {
                place(i, A[i]);
            }
        }

        if (A[0] != 0) {
            place(0, N - 1);
        }

        for (i = 1; i < N && A[i - 1] < A[i]; ++i);

        if (i < N || line > 5 * N) System.exit(7 / 0);

        System.out.println(line);
        System.out.println(sb);
    }

    void place(int a, int b) throws Exception {
        if (Math.abs(a - b) * 2 >= N) {
            swap(a, b);
        }
        else if (Math.abs(a - 0) * 2 >= N) {
            swap(a, 0);

            if (Math.abs(0 - b) * 2 >= N) swap(0, b);
            else {
                swap(0, N - 1); swap(N - 1, b);
            }
        } else if (Math.abs(N - 1 - a) * 2 >= N) {
            swap(a, N - 1);

            if (Math.abs(N - 1 - b) * 2 >= N) swap(N - 1, b);
            else {
                swap(N - 1, 0); swap(0, b);
            }
        } else {
            System.out.println(a + " " + b);
            System.exit(7 / 0);
        }
    }

    void swap(int a, int b) throws Exception {
        if (2 * Math.abs(a - b) < N) System.exit(7 / 0);

        A[a] ^= A[b]; A[b] ^= A[a]; A[a] ^= A[b];

        ++line;
        sb.append(++a + " " + ++b).append("\n");
    }
}


class IO {
    static byte[] buf = new byte[2048];
    static int index, total;
    static InputStream in;
    static BufferedWriter bw;


    IO(InputStream is, OutputStream os) {
        try {
            in = is;
            bw = new BufferedWriter(new OutputStreamWriter(os));
        } catch (Exception e) {
        }
    }

    IO(String inputFile, String outputFile) {
        try {
            in = new FileInputStream(inputFile);
            bw = new BufferedWriter(new OutputStreamWriter(
                    new FileOutputStream(outputFile)));
        } catch (Exception e) {
        }
    }

    int scan() throws Exception {
        if (index >= total) {
            index = 0;
            total = in.read(buf);
            if (total <= 0)
                return -1;
        }
        return buf[index++];
    }

    String next() throws Exception {
        int c;
        for (c = scan(); c <= 32; c = scan()) ;
        StringBuilder sb = new StringBuilder();
        for (; c > 32; c = scan())
            sb.append((char) c);
        return sb.toString();
    }

    int nextInt() throws Exception {
        int c, val = 0;
        for (c = scan(); c <= 32; c = scan()) ;
        boolean neg = c == '-';
        if (c == '-' || c == '+')
            c = scan();
        for (; c >= '0' && c <= '9'; c = scan())
            val = (val << 3) + (val << 1) + (c & 15);
        return neg ? -val : val;
    }

    long nextLong() throws Exception {
        int c;
        long val = 0;
        for (c = scan(); c <= 32; c = scan()) ;
        boolean neg = c == '-';
        if (c == '-' || c == '+')
            c = scan();
        for (; c >= '0' && c <= '9'; c = scan())
            val = (val << 3) + (val << 1) + (c & 15);
        return neg ? -val : val;
    }

    void print(Object a) throws Exception {
        bw.write(a.toString());
    }

    void printsp(Object a) throws Exception {
        print(a);
        bw.write(" ");
    }

    void println() throws Exception {
        bw.write("\n");
    }

    void println(Object a) throws Exception {
        print(a);
        println();
    }

    void flush() throws Exception {
        bw.flush();
        bw.close();
    }
}