n = gets.to_i
nums = gets.split.map(&:to_i)
count = 0
for i in 0..n-2
  minid = i
  for k in i..n-1 do
    if nums[minid] > nums[k]
      minid = k
    end
  end
  #print i != minid
  if i != minid
    nums[minid], nums[i] = nums[i], nums[minid]
    count += 1
  end
  #puts nums.join(" ")
end
puts nums.join(" "), count
