N = gets.to_i

num =gets.split.map(&:to_i)
cnt =0

N.times.each do |i|
minj = i

(i..N-1).each do |j|
if num[j] < num[minj]
minj = j

end
end

if minj != i
work = num[i]
num[i] = num[minj]
num[minj] = work
cnt +=1

end

end

puts num.join(" ")
puts cnt