n =  gets.to_i
array = gets.split.map(&:to_i)
cnt = 0
for i in 0..n-1
	indexMin = i
	for k in i..n-1
		if array[k] < array[indexMin]
			indexMin = k
		end
	end
	array[i],array[indexMin] = array[indexMin],array[i]
	if i != indexMin
	    cnt += 1
	end
end

p array.join(" ")
puts cnt