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:
// package codeforcesGR3;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.List;

public class C {
  InputStream is;
  PrintWriter out;
  String INPUT = "6\n" +
      "2 5 3 1 4 6";

  void solve() {
    int n = ni();
    List<String> res = new ArrayList<>();
    int[] a = na(n);
    // System.out.println("a = " + Arrays.toString(a));
    // testSwap(n, a, res, 2, 1);
    // System.exit(0);
    for (int i = 0; i < n; i++) {
      while (a[i] - 1 != i) {
        int toindex = a[i] - 1;
        if ((toindex - i) * 2 >= n) {
          swap(a, res, i, toindex);
        } else {
          if (i < n / 2 && toindex < n / 2) {
            swap(a, res, i, n - 1);
            swap(a, res, toindex, n - 1);
          } else if (i >= n / 2 && toindex >= n / 2) {
            swap(a, res, i, 0);
            swap(a, res, toindex, 0);
          } else {
            testSwap(n, a, res, i, toindex);
          }
        }
      }
    }
    out.println(res.size());
    for (String row : res) {
      out.println(row);
    }
  }

  private void testSwap(int n, int[] a, List<String> res, int i, int toindex) {
    if (i > toindex) {
      int d = i;
      i = toindex;
      toindex = d;
    }
    swap(a, res, i, n - 1);
    swap(a, res, toindex, 0);
    swap(a, res, 0, n - 1);
    swap(a, res, 0, toindex);
    swap(a, res, i, n - 1);
  }

  private void swap(int[] a, List<String> res, int i, int toindex) {
    if (i == toindex) {
      return;
    }
    if (i > toindex) {
      int tmpvalue = i;
      i = toindex;
      toindex = tmpvalue;
    }
    int tmp = a[i];
    a[i] = a[toindex];
    a[toindex] = tmp;
    // System.out.println(String.format("%d %d", i + 1, toindex + 1));
    // System.out.println("a = " + Arrays.toString(a));
    // System.out.println();
    res.add(String.format("%d %d", i + 1, toindex + 1));
  }

  void run() throws Exception {
    is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());
    out = new PrintWriter(System.out);

    long s = System.currentTimeMillis();
    solve();
    out.flush();
    tr(System.currentTimeMillis() - s + "ms");
  }

  public static void main(String[] args) throws Exception {
    new C().run();
  }

  private byte[] inbuf = new byte[1024];
  public int lenbuf = 0, ptrbuf = 0;

  private int readByte() {
    if (lenbuf == -1) throw new InputMismatchException();
    if (ptrbuf >= lenbuf) {
      ptrbuf = 0;
      try {
        lenbuf = is.read(inbuf);
      } catch (IOException e) {
        throw new InputMismatchException();
      }
      if (lenbuf <= 0) return -1;
    }
    return inbuf[ptrbuf++];
  }

  private boolean isSpaceChar(int c) {
    return !(c >= 33 && c <= 126);
  }

  private int skip() {
    int b;
    while ((b = readByte()) != -1 && isSpaceChar(b)) ;
    return b;
  }

  private double nd() {
    return Double.parseDouble(ns());
  }

  private char nc() {
    return (char) skip();
  }

  private String ns() {
    int b = skip();
    StringBuilder sb = new StringBuilder();
    while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
      sb.appendCodePoint(b);
      b = readByte();
    }
    return sb.toString();
  }

  private char[] ns(int n) {
    char[] buf = new char[n];
    int b = skip(), p = 0;
    while (p < n && !(isSpaceChar(b))) {
      buf[p++] = (char) b;
      b = readByte();
    }
    return n == p ? buf : Arrays.copyOf(buf, p);
  }

  private char[][] nm(int n, int m) {
    char[][] map = new char[n][];
    for (int i = 0; i < n; i++) map[i] = ns(m);
    return map;
  }

  private int[] na(int n) {
    int[] a = new int[n];
    for (int i = 0; i < n; i++) a[i] = ni();
    return a;
  }

  private int ni() {
    int num = 0, b;
    boolean minus = false;
    while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
    if (b == '-') {
      minus = true;
      b = readByte();
    }

    while (true) {
      if (b >= '0' && b <= '9') {
        num = num * 10 + (b - '0');
      } else {
        return minus ? -num : num;
      }
      b = readByte();
    }
  }

  private long nl() {
    long num = 0;
    int b;
    boolean minus = false;
    while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
    if (b == '-') {
      minus = true;
      b = readByte();
    }

    while (true) {
      if (b >= '0' && b <= '9') {
        num = num * 10 + (b - '0');
      } else {
        return minus ? -num : num;
      }
      b = readByte();
    }
  }

  private boolean oj = true;

  private void tr(Object... o) {
    if (!oj) System.out.println(Arrays.deepToString(o));
  }
}