arr = []
count = 0
n = gets
arr = gets.chomp.split.map(&:to_i)

arr.length.times do |i|
  mini = i
  j = i
  while j < arr.length
    if(arr[j] < arr[mini])
      mini = j
    end
    j += 1
  end
  if(i != mini)
    temp = arr[i]
    arr[i] = arr[mini]
    arr[mini] = temp
    count += 1
  end
end
puts arr.join(' ')
puts count
