len = gets.to_i
arr = gets.split(' ').map(&:to_i)

cnt = 0
0.upto(len-2) do |i|
  minj = i
  (i+1).upto(len-1) do |j|
    minj = j if arr[minj] > arr[j]
  end
  if minj != i
    arr[i], arr[minj] = arr[minj], arr[i]
    cnt += 1
  end
end

puts arr.join(' ')
puts cnt
