def selection_sort(a)
  n = a.length
  i = 0
  sw = 0
  while i < n do
    j = i
    minj = i
    while j < n do
      if a[j] < a[minj]
        minj = j
      end
      j += 1
    end
    t = a[i]
    a[i] = a[minj]
    a[minj] = t
    if i != minj
      sw += 1
    end
    i += 1
  end
  i = 0
  while i < n do
    print " " if i > 0
    print a[i]
    i += 1
  end
  puts ""
  puts sw
end

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

selection_sort(a)

