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.lang.*;
import java.awt.*;
import java.awt.geom.*;
import java.math.*;
import java.text.*;
import java.math.BigInteger.*;
import java.util.Arrays; 

public class   CFGLOBAL3
{
  BufferedReader in;
  StringTokenizer as;
  int nums[],nums2[];
  int[] nums1[];
  int a;
  boolean con = true;
 
  ArrayList < String >  ar = new ArrayList < String >();
  public static void main (String[] args)
  {
    new CFGLOBAL3  ();
  }
  
  public int GCD(int a, int b) {
    if (b==0) return a;
    return GCD(b,a%b);
  }
  
  public int LIS(int arr[])
  {
    int n = arr.length;
    int sun[] = new int [n];
    int cur = 0;
    for(int x = 0;x<n;x++)
    {
      int temp = Arrays.binarySearch(sun,0,cur,arr[x]);
      if(temp < 0)
        temp = -temp -1;
      sun[temp] = arr[x];
      if(temp == cur)
        cur++;
    }
    return cur;
    
  }
  
  public void swap(int aa, int b)
  {
    if(aa < b)
    ar.add((aa+1) + " " + (b+1) + "\n");
    else
          ar.add((b+1) + " " + (aa+1) + "\n");
    int temp = nums[aa];
    nums2[nums[aa]] = b;
    nums2[nums[b]] = aa;
    nums[aa] = nums[b];
    nums[b] = temp;

  }
  
  
  public CFGLOBAL3  ()
  {
    try
    {
      
      in = new BufferedReader (new InputStreamReader (System.in));
              BufferedWriter log = new BufferedWriter(new OutputStreamWriter(System.out));

       a = nextInt();
      nums = new int [a];
      nums2 = new int [a];
     
      for(int x = 0;x<a;x++)
      {
        nums[x] = nextInt()-1;
        nums2[nums[x]] = x;
      }
      for(int x  = 0;x<a;x++)
      {
        if(nums[x] != x)
        {
          int loc = nums2[x];
          if(Math.abs(loc-x) >= a/2)
            swap(x,loc);
          else
          {
            if(loc >= a/2 && x < a/2)
            {
              swap(loc,0);
              swap(0,a-1);
              swap(a-1,x);
              swap(loc,0);
            }
            else if(loc >= a/2 && x >= a/2)
            {
              swap(loc,0);
              swap(0,x);
              swap(loc,0);
            }
            else if(loc < a/2 && x < a/2)
            {
              swap(loc,a-1);
              swap(a-1,x);
            }
            
            
          }
        }
      }
      System.out.println(ar.size());
      for(int x = 0;x<ar.size();x++)
      {
        log.write(ar.get(x));
      }
      log.flush();

    }
    catch(IOException e)
    {

    }
  }
  
  
  
  
  
  
  
  String next () throws IOException
  {
    while (as == null || !as.hasMoreTokens ())
    {
      as = new StringTokenizer (in.readLine ().trim ());
    }
    
    
    return as.nextToken ();
  }
  
  
  
  long nextLong () throws IOException
  {
    return Long.parseLong (next ());
  }
  
  
  int nextInt () throws IOException
  {
    return Integer.parseInt (next ());
  }
  
  
  double nextDouble () throws IOException
  {
    return Double.parseDouble (next ());
  }
  
  
  String nextLine () throws IOException
  {
    return in.readLine ().trim ();
  }
}