N = io.read "l"
sum = 0
op = 0
for a in io.read "l":gmatch "%-?%d+" do
    a = tonumber(a)
    if sum > 0 then
        if a >= -sum then
            aNew = -sum - 1
            op = op + math.abs(a - aNew)
            a = aNew
        end
    elseif sum < 0 then
        if a <= -sum then
            aNew = -sum + 1
            op = op + math.abs(a - aNew)
            a = aNew
        end
    end
    sum = sum + a
end
print(("%d"):format(math.op))
