using System; using System.Collections.Generic; using System.Linq; class Magatro { static void Main() { List L = new List(); int N = int.Parse(Console.ReadLine()); int[] a = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray(); for(int i = N; i >=1; i--) { for(int j = 0; j < i-1; j++) { if (a[j] > a[j + 1]) { int q = a[j]; a[j] = a[j+1] ; a[j + 1] = q; L.Add(string.Format("{0} {1}", j, j + 1)); } } } Console.WriteLine(L.Count); for(int i = 0; i < L.Count; i++) { Console.WriteLine(L[i]); } Console.WriteLine(); } }