n = gets.to_i
s = gets.to_s
A= s.split(" ")

def selectionSort(array , n)
   exchange_cnt = 0

   for i in 0..(n  - 1)
	  exchange_flg = 0

	  minj = i
	  for j in i..( n - 1 )
		 if array[j] < array[minj]
			minj = j
			exchange_flg  = 1
		 end
	  end

	  # A[i] と A[minj] を交換
	  if exchange_flg == 1
		 tmp = array[i]
		 array[i] = array[minj]
		 array[minj] = tmp
		 exchange_cnt += 1		 
	  end
   end

   puts array.join(' ')
   puts exchange_cnt
end

selectionSort(A,n)

