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 PYTHON3):

Solution:
 
# seg=[0]*100005
 
 
# def build_query(ind,low,high):
# 	if low==high:
# 		seg[ind]=arr[low]
# 		return
 
# 	mid=low+(high-low)//2
# 	build_query(2*ind+1,low,mid) #left call
# 	build_query(2*ind+2,mid+1,high) #right call
# 	seg[ind]=min(seg[2*ind+1],seg[2*ind+2])
 
 
# def query(ind,low,high,l,r):
# 	#Completely overlap
# 	if low>=l and high<=r:
# 		return seg[ind]
 
# 	#No overlap
# 	if high<l or low>r:
# 		return 3636838
 
# 	#Partially overlap
# 	mid=low+(high-low)//2
# 	left=query(2*ind+1,low,mid,l,r)
# 	right=query(2*ind+2,mid+1,high,l,r)
# 	return min(left,right)
 
 
 
 
 
 
# # arr=[10,20,30,40,11,22,33,44,15,5]
# n,m=map(int,input().split())
# arr=list(map(int,input().split()))
# low=0
# high=len(arr)-1
# build_query(0,low,high)
# # m=1
# # print("Enter your l and r values ")
# while m:
# 	l,r=map(int,input().split())
# 	ans=query(0,0,high,l,r)
# 	print(ans)
 
# 	m-=1
 
# import math
 
# #Seive of erasthones
# MAX_VALUE=1000001
# seive=[0]*MAX_VALUE
 
# def seive_ers(seive):
 
# 	i=3
# 	while i<MAX_VALUE:
# 		seive[i]=1
# 		i+=2
 
 
# 	i=3
# 	while i<MAX_VALUE:
# 		if seive[i]==1:
# 			j=i*i
# 			while j<MAX_VALUE:
# 				seive[j]=0
# 				j+=i
# 		i+=2
 
# 	seive[2]=1
# 	seive[1]=0
# 	seive[0]=0
 
 
 
 
import math
 
def solve():
	n=int(input())
	arr=list(map(int,input().split()))

	count=0
	index_arr=[]

	i=0
	while i<n:
		# print(arr)

		temp=arr[i+1::]
		if len(temp)>0:
			min_of_temp=min(temp)

			for j in range(i+1,len(arr)):
				if arr[j]==min_of_temp:
					index_of_min=j
					break


			# index_of_min=arr.index(min_of_temp)

			if arr[i]>arr[index_of_min]:
				index_arr.append([i,index_of_min])
				arr[i],arr[index_of_min]=arr[index_of_min],arr[i]





		i+=1
	# print(arr)
	
	if len(index_arr)>0:
		print(len(index_arr))
		for val in index_arr:
			print(val[0],end=" ")
			print(val[1])



	else:
		print(0)

	
	
 
 
 
 
 
 
 
 
 
 
 
 
solve()
 
	
# t=int(input())
# # seive_ers(seive)
# while t:
# 	solve()
# 	t-=1
 
# # # solve(