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

public class Main {
    static final int MOD = 1000000007; // 1e9 + 7
    static final boolean AUTO_FLUSH = false; // slow if true
    // int = num(); // long = ll();
    // string = next(); // a string line = line();
    // ---------------------------------- \
    List<String> list = new ArrayList<>();
    int[] itv, vti;
    int n;
    @SuppressWarnings("unchecked")
    void SOLVE_THE_PROBLEM() throws Exception {
        n = num();
        itv = new int[n+1];
        vti = new int[n+1];
        for (int i = 1; i <= n; i++) {
            int v = num();
            itv[i] = v;
            vti[v] = i;
        }
        for (int i = 1; i <= n; i++)
            swap(i, vti[i]);
        outln(list.size());
        for (String s : list)
            outln(s);
    }
    void swap(int i, int j) {
        if (i == j)
            return;
        int a = Math.min(i, j),
            b = Math.max(i, j);
        if (b-a < n/2) {
            if (b <= n/2) {
                swap(b, n);
                swap(a, n);
                swap(b, n);
            } else {
                swap(1, a);
                swap(1, b);
                swap(1, a);
            }
            return;
        }

        String s = a + " " + b;
        if (!list.isEmpty() && list.get(list.size()-1).equals(s))
            list.remove(list.size()-1);
        else
            list.add(s);
        vti[itv[i]] = j;
        vti[itv[j]] = i;

        int temp = itv[i];
        itv[i] = itv[j];
        itv[j] = temp;
    }
    // ---------------------------------- \
    public static void main(String[] args) throws Exception {
        new Thread(null, () -> {
            try {
                startTime();
                new Main().SOLVE_THE_PROBLEM();
                boolean endsWithEnter = TO_BE_PRINTED.length() == 0 || TO_BE_PRINTED.charAt(TO_BE_PRINTED.length() - 1) == '\n';
                flush();
                if (!endsWithEnter)
                    log('\n');
                logTime();
                logMem();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }, "Main", 1<<26).start();
    }
    static Random RAND = new Random();
    static int random(int from, int to) {
        return RAND.nextInt(to-from+1)+from;
    }
    static void logTime() {
        log("Time: " + getTime() + "ms");
    }
    static void logMem() {
        log("Memory (End): " + (int) (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / 1024 + " KB");
    }
    static long ll() {
        return Long.parseLong(next());
    }
    static int num() {
        return Integer.parseInt(next());
    }
    static void generateInputMode() throws Exception {
        System.setOut(new PrintStream(new FileOutputStream("F://PROGRAMMING/input.txt")));
    }
    static String line() {
        if (!tokenize())
            return null;
        INPUT_STREAM.setLength(0);
        if (STRING_TOKENIZER.hasMoreTokens())
            INPUT_STREAM.append(STRING_TOKENIZER.nextToken());
        while (STRING_TOKENIZER.hasMoreTokens())
            INPUT_STREAM.append(' ').append(STRING_TOKENIZER.nextToken());
        return INPUT_STREAM.length() == 0 ? null : INPUT_STREAM.toString();
    }
    static void startTime() {
        TIME_COMPLEXITY = System.currentTimeMillis();
    }
    static long getTime() {
        return System.currentTimeMillis() - TIME_COMPLEXITY;
    }
    static void flush() {
        System.out.print(TO_BE_PRINTED.toString());
        TO_BE_PRINTED.setLength(0);
    }
    static void out(Object o) {
        TO_BE_PRINTED.append(o.toString());
        if (AUTO_FLUSH)
            flush();
    }
    static void _log(String s) {
        System.err.print(s);
    }
    static void _logln(String s) {
        System.err.println(s);
    }
    static void _logln() {
        System.err.println();
    }
    static void outln(Object o) {
        out(o);
        outln();
    }
    static void outln() {
        out("\n");
    }
    static class Pair implements Comparable<Pair> {
        public int a, b;
        public Pair(int a, int b) {
            this.a = a;
            this.b = b;
        }
        public static Pair of(int a, int b) {
            return new Pair(a, b);
        }
        public int compareTo(Pair p) {
            if (a == p.a)
                return Integer.compare(b, p.b);
            return Integer.compare(a, p.a);
        }
        public String toString() {
            return "[" + a + "," + b + "]";
        }
        public boolean equals(Pair p) {
            return p.a == a && p.b == b;
        }
    }
    static void logArr(Object val) {
        Class<?> valKlass = val.getClass();
        Object[] outputArray = null;
        for(Class<?> arrKlass : new Class<?>[] { int[].class, float[].class, double[].class, boolean[].class, 
            byte[].class, short[].class, long[].class, char[].class }) {
            if (valKlass.isAssignableFrom(arrKlass)) {
                int arrlength = Array.getLength(val);
                outputArray = new Object[arrlength];
                for(int i = 0; i < arrlength; ++i)
                    outputArray[i] = Array.get(val, i);
                break;
            }
        }
        if(outputArray == null)
            outputArray = (Object[])val;
        logArr0(outputArray);
    }
    static void logArr0(Object[] objs) {
        _log("* " + objs[0]);
        for (int i = 1; i < objs.length; i++)
            _log(objs[i].toString().equals("\n") ? "\n>" : (" " + objs[i]));
        _logln();
    }
    static void log(Object... objs) {
        logArr0(objs);
    }
    static String next() {
        return tokenize() ? STRING_TOKENIZER.nextToken() : null;
    }
    static boolean tokenize() {
        if (STRING_TOKENIZER == null || !STRING_TOKENIZER.hasMoreTokens()) {
            try {
                STRING_TOKENIZER = new StringTokenizer(STREAM_READER.readLine());
            } catch (Exception e) {
                return false;
            }
        }
        return true;
    }
    static long TIME_COMPLEXITY;
    static BufferedReader STREAM_READER = new BufferedReader(new InputStreamReader(System.in), 32768);
    static StringTokenizer STRING_TOKENIZER;
    static StringBuilder INPUT_STREAM = new StringBuilder(), TO_BE_PRINTED = new StringBuilder();
}