class String
  def to_ia
    self.split(/\s+/).map {|s| s.to_i}
  end
end
 
class Array
  def swap(i, j)
    t = self[i]
    self[i] = self[j]
    self[j] = t
  end
end

def insertion_sort(ary)
  swaps = 0
  n = ary.size
  (0...n).each do |i|
    min = i
    (i...n).each do |j|
      if ary[j] < ary[min]
        min = j
      end
    end
    unless i == min
      ary.swap i, min
      swaps += 1
    end
  end
  puts ary.join(" ")
  puts swaps
end
 
STDIN.readline
ary = STDIN.readline.to_ia
insertion_sort(ary)