n = gets.strip.to_i
array = gets.split(' ').map(&:to_i)
swap_count = 0

0.upto(array.size-1) do |i1|
  i_min = i1
  (i1+1).upto(array.size-1) do |i2|
    if (array[i2] < array[i_min]) then
      i_min = i2
    end
  end

  if (i_min != i1) then
    array[i_min], array[i1] = array[i1], array[i_min]
    swap_count += 1
  end
end

puts array.join(' ')
p swap_count