def selection_sort(array)
  times = 0
  (0...array.size).each do |i|
    mini = i
    (i...array.size).each do |j|
      mini = j if array[j] < array[mini]
    end
    if i != mini
      times += 1
      array[i], array[mini] = array[mini], array[i]
    end
  end
  [array, times]
end
n = gets.to_i
s = gets.split.map(&:to_i)
array, times = selection_sort(s)
puts array.join(' ')
puts times