def selection_sort(a)
  c = 0
  for i in 0..(a.length - 1)
    min = i
    for j in i ..(a.length - 1)
      if a[j] < a[min]
        min = j
      end
    end
    if i != min
      a[i], a[min] = a[min], a[i]
      c += 1
    end
  end
  [a,c]
end

gets
a,c = selection_sort(gets.split.map(&:to_i))
puts a.join(' ')
puts c