n = gets.to_i

arr = gets.split.map(&:to_i)

count = 0

n.times do |i|
  min_pos = i

  i.upto(n - 1) do |j|
    if arr[j] < arr[min_pos]
      min_pos = j
    end
  end

  if min_pos != i
    arr[i], arr[min_pos] = arr[min_pos], arr[i]
    count += 1
  end
end

puts arr.join(' ')
puts count