N = gets.to_i
a = gets.split.map {|i| i.to_i}

cnt = 0

0.upto(N - 1) do |i|
	minj = i
	i.upto(N - 1) do |j|
		minj = j if a[j] < a[minj]
	end
	if i != minj
		a[i], a[minj] = a[minj], a[i]
		cnt += 1
	end
end

puts a.join(" ")
puts cnt