N = gets.to_i
A = gets.split.map(&:to_i)
ans = 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]
	ans += 1 if i != minj
end

puts A.join(" ")
puts ans
