n = gets.to_i - 1
a = gets.split.map &:to_i
c = 0
n.times do |i|
  m = i
  i.upto(n) do |j|
    m = j if a[j] < a[m]
  end
  a[i], a[m] = a[m], a[i]
  c += 1 if i != m
end
puts sprintf("%s\n%d\n", a.join(' '), c)