def geta(n=0)
  return $stdin.gets.to_i if n==0
  ar = []
  n.times do 
    ar << $stdin.gets.chomp.split
  end
  return ar.flatten(1) if n<=1
  return ar
end

def exchange(i,n)
  min = Float::INFINITY
  idx = 0
  i.step(n-1) do |j|
    if min > @ar[j]
      min = @ar[j]
      idx = j
    end
  end
  @ar[i],@ar[idx] = @ar[idx],@ar[i]
  return 1
end

n = geta(0)
@ar = geta(1).map(&:to_i)

cnt = 0
0.step(n-1) do |i|
  cnt += exchange(i,n)
end

puts @ar.join(" ")
p cnt
