def selectionSort(a, n)
  count = 0
  for i in 0..n-1
    minj = i
    for j in i..n-1
      minj = j if a[j] < a[minj]
    end
    if i != minj then
      a[i], a[minj] = a[minj], a[i]
      count+=1
    end
  end
  puts a.join(" ")
  puts count
end

n = gets.to_i
a = gets.split.map(&:to_i)
selectionSort(a, n)