n = gets.chomp.to_i
a = gets.chomp.split(" ").map(&:to_i)

cnt = 0

for i in 0..n-1
	minj = i
	for j in i..n-1
		if a[j] < a[minj]
			minj = j
		end
	end
	a[i],a[minj] = a[minj],a[i]
	if a[i]!=a[minj]
		cnt+=1
	end
end

puts a.join(" ")
puts cnt