# ALDS1_2_B Selection Sort
n = gets.chomp.to_i
a = gets.chomp.split(" ").map(&:to_i)
def selectionSort(a, n)
  res = 0
  (0..n-1).each do |i|
    minj = i
    (i..n-1).each do |j|
      if a[j] < a[minj] then
        minj = j
      end
    end
    if a[i] != a[minj] then
      a[i], a[minj] = a[minj], a[i]
      res += 1
    end
  end
  puts a.join(" ")
  puts res
end

selectionSort(a, n)