class Array
  def swap!(a, b)
    self[a], self[b] = self[b], self[a]
    self
  end
end
def selection_sort(array)
  count = 0
  array.length.times do |index|
    min = array[index]
    min_index = index
    array[index..array.length-1].each_with_index do |value, cindex|
      if min > value
        min_index = cindex + index
        min = value
      end
    end
    if index != min_index
      array.swap! index, min_index
      count += 1
    end
  end
  [array, count]
end

n = gets.to_i
array = gets.split(' ').map(&:to_i)
array, count = selection_sort array
puts array.join(' '), count

