N=gets.to_i
A=gets.split.map(&:to_i)

def selectionSort(a, n, cnt)
  (N-1).times do |i|
    minj=i
    ((i).upto(N-1)).each do |j|
      if A[j] < A[minj]
        minj = j
      end
    end
    next if i == minj
    A[i], A[minj] = A[minj], A[i]
    cnt+=1
  end
  return A.join(" "), cnt
end

puts selectionSort(A, N, 0)

