a = gets.chomp.to_i
n = gets.chomp.split(" ").map(&:to_i)
flag = 1
count = 0
for i in 0..(a-1) do 
  minj = i
  for j in i..(a-1) do 
    if(n[j] < n[minj])
      minj = j
    end
  end
  count += 1 unless n[minj] == n[i]
  n[minj],n[i] = n[i],n[minj]
  
end
n[0,a-1].each do |d|
  print("#{d} ")
end
puts("#{n[a-1]}")
puts count