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

count = 0
n.times do |i|

   minIndex = i

   for j in i..(n-1) do

      if nums[j] < nums[minIndex]
         minIndex = j
      end

   end

   if minIndex != i
      temp = nums[i]
      nums[i] = nums[minIndex]
      nums[minIndex] = temp
      count += 1
   end

end

puts nums.join(' ')
puts count