using System;

class Solution {
  public static void Main(string[] args) {
      int n = int.Parse(Console.ReadLine());
            int[] mas = new int[n];
            int[] mas2 = new int[n];
            for (int i = 0; i < n; i++)
            {
                mas[i] = int.Parse(Console.ReadLine());
                mas2[i] = mas[i];
            }
            Array.Sort(mas);
            Console.WriteLine(n - 1);
            for (int i = 0; i < n - 1; i++)
            {
                Console.WriteLine((i+1) + " " + (Array.IndexOf(mas2, mas[i])+1));
                int ind = Array.IndexOf(mas2, mas[i]);
                mas[i] = -1;
                for(int j = i; j < Math.Ceiling((decimal)(i + ind) / 2); j++)
                {
                    int x = mas2[j];
                    mas2[j] = mas2[i + ind - j];
                    mas2[i + ind - j] = x;
                }
            }
  }
}
