def selectionSort(a,n)
	$count = 0
	0.upto(n-1){|i|
		minj=i
		i.upto(n-1){|j|
			if a[j] < a[minj] 
				minj=j
			end
		}
		if i!=minj then
			tmp=a[i];a[i]= a[minj];a[minj]=tmp
			$count += 1
		end
	}
end

n = gets.to_i
a = gets.split.map{|f|f.to_i}

selectionSort a,n

puts a*' '
puts $count 