def selection_sort(a) # N個の要素を含む0-オリジンの配列A
  count = 0
  for i in 0...(a.length)
    minj = i
    for j in i...(a.length)
      if a[j] < a[minj]
        minj = j
      end
    end
    if a[i] != a[minj]
      count += 1
    end
    old_ai = a[i]
    a[i] = a[minj]
    a[minj] = old_ai
  end

  puts a.join(" ")
  puts count
end

gets

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

selection_sort(a)

