def selectionSort(a, n)
  count = 0
  0.upto(n-1) do |i|
    minj = i
    for j in i..(n-1)
      minj = j if a[j] < a[minj]
    end
    if i != minj
      a[i], a[minj] = a[minj], a[i]
      count += 1
    end
  end
  puts a.join(' '), count
end

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

