n = gets.to_i
a = gets.split(' ').map(&:to_i)
cnt = 0

for i in 0..(n-1) do
  min_j = i
  for j in i..(n-1) do
    if a[j] < a[min_j] then
      min_j = j
    end
  end
  
  unless i == min_j then
    a[i], a[min_j] = a[min_j], a[i]
    cnt += 1
  end
end

puts a.join(' ')
puts cnt