N = gets.to_i
A = gets.split.map(&:to_i)
count = 0
0.upto(N-1) do |i|
  minj = i
  i.upto(N-1) do |j|
    if A[j] < A[minj]
      minj = j
    end
  end
  A[i],A[minj] = A[minj],A[i]
  count += 1 if minj != i
end
puts A.join(" ")
puts count