open System open System.Collections.Generic let ri () = stdin.ReadLine() |> int let ria () = stdin.ReadLine().Split() |> Array.map int let swap a b (xs:'t []) = let tmp = xs.[a] xs.[a] <- xs.[b] xs.[b] <- tmp type Sol() = member this.Solve() = let N = ri () let A = ria () let L = new List () for i in 0..(N-2) do let m = A |> Array.skip i |> Array.min let trgt = A |> Array.skip i |> Array.findIndex ( (=) m ) |> (+) i // printfn "%s" (String.Join(" ",A)) // printfn "min: %d" m // printfn "midx:%d" trgt if trgt <> i then ( swap m trgt A ; L.Add(i,trgt) ) L.Count |> printfn "%d" L |> Seq.iter (fun (a,b) -> printfn "%d %d" a b) let dummy = ri() () let mySol = new Sol() mySol.Solve()