program main
implicit none
integer(8) :: i, j, k, nc
integer(8) :: n, sum, sign
integer(8) , allocatable :: a(:)

read(*,*) n
allocate( a(n) )
read(*,*) a

if( a(1) .le. 0 ) then
   sign = -1
else
   sign = 1
end if
sum = a(1)
nc  = 0
do i = 2, n
   sign = sign *(-1)
   if( (sum+a(i))*sign < 0 ) then
      nc = nc+abs(sum+a(i))+1
      a(i) = sign*(abs(sum+a(i))+1) +a(i)
   end if
   sum = sum + a(i)
end do
write(*,'(i0)') nc
end program main
