gets
a = gets.chomp.split.map(&:to_i)
n = 0

for i in 0..a.size-2
  min = i
  for j in i+1..a.size-1
    min = j if a[min] > a[j]
  end
  if i != min
    a[i],a[min] = a[min],a[i]
    n += 1
  end
end

puts a*" "
puts n