n = gets.to_i

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

count = 0

n.times do |i|
  minj = i

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

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

puts arr.join(' ')
puts count