num = gets.to_i
ary = gets.split.map(&:to_i)
  
count = 0
  
for i in 0 .. num-2
  
  min = ary[i]
  min_index = i
  
  for j in i .. num-1
  
    if min > ary[j]
      min = ary[j]
      min_index = j
    end
  end
  
  if ary[i] != ary[min_index]
    ary[i], ary[min_index] = ary[min_index], ary[i]
    count += 1
  end
end

puts ary.join(" "), count
