import java.util.Scanner;

public class Yukicoder397 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt(), cnt = 0;
        int[] a = new int[n];
        int[] res = new int[10000];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        for (int i = 0; i < n; i++) {
            for (int j = i + 1; j < n; j++) {
                if (a[i] < a[j]) {
                    int buf = a[i];
                    a[i] = a[j];
                    a[j] = buf;
                    res[cnt * 2] = i;
                    res[cnt * 2 + 1] = j;
                    cnt++;
                }
            }
        }
        System.out.println(cnt);
        for (int i = 0; i < cnt; i++) {
            System.out.println(res[i * 2] + " " + res[i * 2 + 1]);
        }
        System.out.flush();
        sc.nextInt();
    }
}