n = gets.to_i a = gets.split.map(&:to_i) ans = [] n.times { |i| j = a.each_with_index.min[1] if i != j a[i], a[j] = a[j], a[i] ans << [i,j] end } puts ans.size ans.each { |a,b| puts "#{a} #{b}" } $>.flush gets