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

def selection_sort(a)
  cnt = 0
  0.upto(a.size - 1) do | i |
    min_j = i
    i.upto(a.size - 1) do | j |
      if a[j] < a[min_j]
        min_j = j
      end
    end
    if min_j != i
      cnt += 1
      a[min_j], a[i] = a[i], a[min_j]
    end
  end
  return a, cnt
end

a, cnt = selection_sort(a)
puts a.join(' ')
puts cnt

