n = gets.to_i
a = gets.split.map {|s| s.to_i}
cnt = 0
for i in 0...n
  min = i
  for j in i...n
    min = j if a[j] < a[min]
  end
  if min != i
    t = a[i]
    a[i] = a[min]
    a[min] = t
    cnt += 1
  end
end
for i in 0...n
  print " " unless i==0
  print a[i]
end
print "\n"
puts cnt