$swap = 0

def Swap(a, b)
	$swap += 1
	return b,a
end

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

d.length.times { |i|
	min = i
	(i..d.length).each_with_index { |j|
		min = j if d[min] > d[j]
	}
	d[i],d[min] = Swap(d[i],d[min])
}

d.length.times { |i|
	print " " unless i == 0
	print "#{d[i]}"
}
print "\n#{$swap}\n"