import java.util.Scanner; public class Test { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(), max, idx = 0, tmp; int[] m = new int[n]; int[][] ans = new int[n][2]; for (int i = 0; i < n; i++) { m[i] = sc.nextInt(); } for (int i = 0; i < n - 1; i++) { max = i; for (int j = i + 1; j < n; j++) { if (m[max] < m[j]) { max = j; } } if (i != max) { ans[idx][0] = i; ans[idx][1] = max; idx++; tmp = m[i]; m[i] = m[max]; m[max] = tmp; } } System.out.println(idx); for (int i = 0; i < idx; i++) { System.out.println(ans[i][0] + " " + ans[i][1]); } int p = sc.nextInt(); } }