def selection(n, arr)
    c = 0
    0.upto(n-1) do |i|
        minj = i
        i.upto(n-1) do |j|
            if arr[j] < arr[minj] then
                minj = j
            end
        end
        if i != minj then
            arr[i], arr[minj] = arr[minj], arr[i]
            c += 1
        end
    end
    puts arr.join(" ")
    p c
end
selection(gets.to_i, gets.split.map(&:to_i))