n = gets.to_i
a = gets.split.map(&:to_i)

def selection_sort(a, n)
  cnt = 0
  0.upto(n-1) do |i|
    minj = i

    i.upto(n-1) do |j|
      if a[j] < a[minj]
        minj = j
      end
    end

    if i != minj
      a[i], a[minj] = a[minj], a[i]
      cnt += 1
    end

  end
  puts a.join(" "), cnt
end

selection_sort(a, n)
