Problem: In this problem your goal is to sort an array consisting of n integers in at most n swaps. For the given array find the sequence of swaps that makes the array sorted in the non-descending order. Swaps are performed consecutively, one after another.

Note that in this problem you do not have to minimize the number of swaps — your task is to find any sequence that is no longer than n.

Input

The first line of the input contains integer n (1 ≤ n ≤ 3000) — the number of array elements. The second line contains elements of array: a0, a1, ..., an - 1 ( - 109 ≤ ai ≤ 109), where ai is the i-th element of the array. The elements are numerated from 0 to n - 1 from left to right. Some integers may appear in the array more than once.

Output

In the first line print k (0 ≤ k ≤ n) — the number of swaps. Next k lines must contain the descriptions of the k swaps, one per line. Each swap should be printed as a pair of integers i, j (0 ≤ i, j ≤ n - 1), representing the swap of elements ai and aj. You can print indices in the pairs in any order. The swaps are performed in the order they appear in the output, from the first to the last. It is allowed to print i = j and swap the same pair of elements multiple times.

If there are multiple answers, print any of them. It is guaranteed that at least one answer exists.

Examples

Input

5
5 2 5 1 4


Output

2
0 3
4 2


Input

6
10 20 20 40 60 60


Output

0


Input

2
101 100


Output

1
0 1

Solution (in JAVA):

Solution:
import java.io.*;
import java.util.Random;
import java.util.*;
import java.util.Scanner;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;

public class Main {

	  
	  public static String binary = "";
	  //System.out.println(ans);
	  public static int gcd(int a,int b){
		if(a == 0)
			return b;
		return gcd(b % a, a);
	  }
	  
	  private static void Binaryform(int number) {
        int remainder;
        if (number <= 1) {
            binary += number;
            return;
        }
        remainder = number %2; 
        Binaryform(number >> 1);
        binary += remainder +"";
      }
	  
	  public static void print(Object o){
		System.out.print(o +" ");
	  }
	  
	  public static void println(Object o){
		System.out.println(o);
	  }

	  public  static class Point{
			  public int x = 0;
			  public int y = 0;
			  
			  Point (int x , int y){
				  this.x = x;
				  this.y = y;
				  }
			  	
			}			
		
		public static int isSquare(Point p1, Point p2,Point p3,Point p4){
			double dx = 0, dy = 0;
			double dd [] = new double [6];
			Point [] pp = new Point[4];
			pp[0]=p1; pp[1]=p2; pp[2]=p3; pp[3]=p4;
			int ii = 0; int jj = 0; int kk = 0; int nn = 0;
			
			for(ii = 0; ii < 3; ii++){
				for(jj = ii + 1; jj < 4; jj++){
					dx = pp[ii].x - pp[jj].x;
					dy = pp[ii].y - pp[jj].y;
					dd[kk] = dx*dx + dy*dy;
					if(dd[kk] == 0) return 0;
					if(kk > 1){
						for(nn = 0; nn < kk - 1; nn++){
							if (!( (2*dd[nn] == dd[kk] ) || (dd[nn] == dd[kk]) || (2*dd[kk] == dd[nn] )) ) 
								return 0;
						}
					}
					kk += 1;
				}
			}
			return 1;
		}
		
		static char [] V;
		static char [] R;
		public static void dfsP(int index){
			if(index >= V.length){
				for(int i = 0; i < V.length; i++){
					System.out.print(V[i] +" ");
				}
				System.out.println();
				return;
			}
			if(V[index] == '1')
				for(int i = 0; i < 6; i++){
					
						V[index] = R[i];
						dfsP(index + 1);
				}
			else
				dfsP(index + 1);
		}
		
public static void main(String arg[]){

				Scanner in = new Scanner(System.in);
				PrintWriter out = new PrintWriter(System.out);
				int n = in.nextInt();
				long [] v = new long[n];
				long [] tv = new long[n];
				for(int i = 0; i < n; i++){
					long k = in.nextLong(); 
					v[i] = k;
					tv[i] = k;
				}
				Arrays.sort(tv);
				int cont = 0;
				StringBuilder ans = new StringBuilder();
				boolean f = false;
				for(int i = 0; i < n; i++){
					if(tv[i] != v[i]){
						int index = 0;
						for(int j =0; j < n; j++){
							if(tv[i] == v[j]){
								index = j;
							}
						}
						//out.println(i +" "+index);
						
						
								cont += 1;
								ans.append(i +" "+index+"\n");
								long tem = tv[index];
								v[index] = v[i];
								v[i] = tem;
							
						f = true;
					}
				}
				if(!f)
					out.println(0);
				else{
					out.println(cont);
					out.println(ans.toString());
				}
				in.close();
				out.close();
				
			  }

} 

/*
 *
		public static void main(String arg[]){

				Scanner in = new Scanner(System.in);
				PrintWriter out = new PrintWriter(System.out);
				long n = in.nextInt();
				
				long c = n / 2;
				long a = 0; //impares
				long b = 0; // pares
				if( n % 2 != 0){
					a = 1;
					b = 0;
				}
				a += c; b += c;
				out.println(c*(c+1) - a*a);
				in.close();
				out.close();
				
			  }
			  * 
		public static void main(String arg[]){

				Scanner in = new Scanner(System.in);
				PrintWriter out = new PrintWriter(System.out);
				int m = in.nextInt();
				int n = in.nextInt();
				
				int [][] B = new int[m][n];
				int [][] A = new int[m][n];
				for(int i = 0; i < m; i++){
					for(int j = 0; j < n; j++){
						B[i][j] = in.nextInt();
						A[i][j] = 1;
					}
				}
				boolean f = true;
				for(int i = 0; i < m; i++){
					for(int j = 0; j < n; j++){
						
						if (B[i][j] == 0){
							for(int k = 0; k < n; k++)
								A[i][k] = 0; 
							for(int k = 0; k < m; k++)
								A[k][j] = 0;
						}	
						
					}
					
				}
				
				for(int i = 0; i < m; i++){
					for(int j = 0; j < n; j++){
							
							boolean ocurr = false;
							for(int k = 0; k < n; k++)
								if(A[i][k] == 1) ocurr = true; 
							for(int k = 0; k < m; k++)
								if(A[k][j] == 1) ocurr = true;
							if(ocurr == false){ f = false; break;}
						}
						if(!f) break;
					}
					
				
				
				if(!f) out.println("NO");
				else{
					out.println("YES");
					for(int i = 0; i < m; i++){
						for(int j = 0; j < n; j++){
							out.print(A[i][j] +" ");
						}
						out.println();
					}
				}
				in.close();
				out.close();
				
			  }
*/