n = gets.to_i
as = gets.split.map(&:to_i)
count = 0

n.times do |i|
  minj = i

  (i...n).each do |j|
    minj = j if as[j] < as[minj]
  end

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

puts as.join(' ')
p count

