def selectionSort(number, array)
  count_num = 0
  for i in 0..number-1 do
    minj = i
    # change_array = array[minj]
    for j in i..number-1 do
      if array[j].to_i < array[minj].to_i
        # change_array = array[minj]
        minj = j
        change_array = array[minj]
      end
    end
    if minj != i
      array[minj] = array[i]
      array[i] = change_array
      count_num += 1
    end
  end
  puts array.join(" ").strip
  puts count_num
end

number = gets.to_i
array = gets.to_s.split(" ")

selectionSort(number,array)

