package main import ( "fmt" "sort" ) func solve() { ans := make([]int, 0, 10000) var n int fmt.Scan(&n) a := make([]int, n) for i := 0; i < n; i++ { fmt.Scan(&a[i]) } for i := 0; i < n; i++ { min_v := a[i] min_i := i for j := i+1; j < n; j++ { if a[j] < min_v { min_v = a[j] min_i = j } } if i != min_i { sort.IntSlice(a).Swap(i, min_i) ans = append(ans, i) ans = append(ans, min_i) } } fmt.Println(len(ans) / 2) for i := 0; i < len(ans)/2; i++ { fmt.Println(ans[i*2], ans[i*2+1]) } var dummy string fmt.Scan(&dummy) } func main() { solve() }