n = gets.chomp.to_i
arr = gets.split(' ').map(&:to_i)
count = 0

n.times do |sorted_i|
  min_i = sorted_i
  ((sorted_i)..(n - 1)).each do |j|
    if arr[j] < arr[min_i]
      min_i = j
    end
  end
  if sorted_i != min_i
    count += 1
    tmp = arr[sorted_i]
    arr[sorted_i] = arr[min_i]
    arr[min_i] = tmp
  end
end

puts arr.join(' ')
puts count

