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

ans = 0
(0..n-1).each do |i|
  minj = i
  (i..n-1).each do |j|
    if as[j] < as[minj]
      minj = j
    end
  end
  next if minj == i
  tmp = as[i]
  as[i] = as[minj]
  as[minj] = tmp
  ans += 1
end

puts as.join(" ")
puts ans

