gets
ar = gets.split.map(&:to_i)
l = ar.size
co = 0
(l - 1).times do |i|
  min = i
  (i + 1).upto(l - 1) {|j| min = j if ar[j] < ar[min]}
  ar[min], ar[i] = ar[i], ar[min]
  co += 1 unless i == min
end
puts ar.join(" ")
puts co

