n = gets.to_i
a = gets.split.map(&:to_i)
sum = 0
0.upto(n-1) do |i|
	minj = i
	i.upto(n-1) do |j|
		minj = j if a[j]<a[minj]
	end
	if a[i] != a[minj] then
	    v = a[i]
	    a[i] = a[minj]
	    a[minj] = v
	    sum += 1
	end
end
puts a.join(' ')
puts sum
