n = STDIN.gets.to_i
array = STDIN.gets.split.map(&:to_i)
counter = 0

for i in 0..(n-1) do
  minj = i
  for j in i..(n-1) do
    if array[j] < array[minj]
      minj = j
    end
  end
  counter += 1
  tmp = array[i]
  array[i] = array[minj]
  array[minj] = tmp
end

puts array.join(' ')
puts counter