n=gets.chomp.to_i
ary=Array.new
ary=gets.chomp.split(" ").map{|num| num.to_i}
k=0


for i in 0..n-1
	minj=i
	for j in i..n-1
		if ary[j] < ary[minj]
			minj=j
		end
	end
		x=ary[i]
		ary[i]=ary[minj]
		ary[minj]=x
		k+=1
end
puts ary.join(" ")
puts k