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

n = gets.chomp.to_i
a = gets.chomp.split(" ").map{|x| x.to_i}
count = selectionSort(a,n)
printf("%s\n",a.join(" "))
printf("%d\n",count)
