count = 0
n = gets.chomp.to_i
array = gets.split(" ").map{|x| x.to_i}
 
i = 0
while i<n
  j = i+1
  k = i
  while j<n
    if array[k] > array[j]
      k = j
    end  
    j = j+1
  end
  if k != i
  array[k],array[i] = array[i],array[k]
  count = count + 1
  end
  i=i+1
end
 
i = 0
while i < n 
  print array[i] 
  if i+1 != n
  print " "
  end
  i = i+1
end
print "\n"
print count
print "\n"