n = gets.to_i
line = gets.split(' ').map(&:to_i)
total_trade = 0

n.times do |i|
  index = line[i..-1].index(line[i..-1].min) + i
  next if i == index

  tmp = line[i]
  line[i] = line[index]
  line[index] = tmp
  total_trade += 1
end

puts line.join(' ')
puts total_trade
