import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] a = new int[n]; for(int i = 0; i < n; i++) { a[i] = sc.nextInt(); } ArrayList list1 = new ArrayList(); ArrayList list2 = new ArrayList(); for(int i = 0; i < n; i++) { for(int j = i + 1; j < n; j++) { if(a[i] > a[j]) { list1.add(i); list2.add(j); int s = a[j]; a[j] = a[i]; a[i] = s; } } } System.out.println(list1.size()); for(int i = 0; i < list1.size(); i++) { System.out.println(list1.get(i) + " " + list2.get(i)); } int t = sc.nextInt(); System.out.flush(); } }