def selectionSort(a, n)
  cnt = 0
  (0..n-1).each do |i|
    minj = i
    (i..n-1).each do |j|
      if a[j] < a[minj]
        minj = j
      end
    end
    if i != minj
      tmp = a[i]
      a[i] = a[minj]
      a[minj] = tmp
      cnt += 1
    end
  end
  puts a.join(' ')
  puts cnt
end

n = gets.to_i
a = gets.split.map(&:to_i)
selectionSort(a, n)
