import java.util.ArrayList; import java.util.Scanner; public class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { int N = sc.nextInt(); int[] A = new int[N]; for (int i = 0; i < N; ++i) { A[i] = sc.nextInt(); } ArrayList q = new ArrayList<>(); for (int i = 0; i < N; ++i) { int idx = -1; int min = 999; for (int j = i; j < N; ++j) { if (A[j] < min) { min = A[j]; idx = j; } } if (idx != i) { q.add((idx << 16) + i); A[idx] = A[i]; A[i] = min; } } System.out.println(q.size()); for (int v : q) { System.out.println((v >> 16) + " " + (v & 0xFFFF)); } System.out.flush(); sc.next(); } }