def selectionSort(arr)
  count = 0
  arr.size.times do |i|
    mini_j = i
    i.upto(arr.size - 1) do |j|
      mini_j = j if arr[j] < arr[mini_j]
    end

    if mini_j != i
      arr[i], arr[mini_j] = arr[mini_j], arr[i]
      count += 1
    end
  end
  count
end

n = gets.to_i
arr = gets.split.map(&:to_i)

count = selectionSort(arr)
puts arr.join("\s")
puts count