#include<bits/stdc++.h>
#define FF ios_base::sync_with_stdio(0);cin.tie(0)
#define binary(value, size) cout << bitset<size>(value) << '\n'
#define PI acos(-1.0)   //3.1416(180 degree to radian)
#define PIby2 asin(1)     //(3.1416/2) for angle(90 degree to radian)
#define eps 1e-67
#define pf printf
#define sf scanf
#define sz size()
#define rr read
#define ww write
#define clr(arr) memset((arr),0,(sizeof(arr)))
#define rep(i,a,b) for(long long int i=a;i<b;i++)
#define repb(i,a,b) for(long long int i=a;i>=b;i--)
#define repa(i,a,b,c) for(long long int i=a;i<b;i=i+c)
#define reps(i,a,b,c) for(long long int i=a;i>b;i=i-c)
#define asort(a) sort(a.begin(),a.end())
#define asort2(a,comp) sort(a.begin(),a.end(),comp)
#define arev(a) reverse(a.begin(),a.end())
#define all(v) (v).begin(),(v).end()
#define all2(v,a,b) (v).begin()+a,(v).end()-b
#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define pbb pop_back
#define mp make_pair
#define mt make_tuple
#define BS(v,x) binary_search(v.begin(),v.end(),x) //return true /false
#define LB(v,x) lower_bound(v.begin(),v.end(),x) //found and that value and not found than greater value pos
#define UB(v,x) upper_bound(v.begin(),v.end(),x) //found and greater value pos && not found also greater pos
#define convertlower(c) towlower(c)
#define root(x) sqrt(x)
#define power(a,n) pow(a,n)
#define tu(c) towupper(c)
#define sq(a) ((a)*(a))
#define cube(a) ((a)*(a)*(a))
#define mx 1000
#define MX 100000
#define mod 1000000007
#define INF 2000000000
#define N 10000000
#define Ceil(n) (long long int)ceil(n)
#define Floor(n) (long long int)floor(n)
#define deb(x) std::cout << #x << " = " << x << std::endl;
#define out(ans) cout<<ans<<endl
#define outs(ans) cout<<ans<<" "<<endl
using namespace std;
typedef string str;
typedef long long int ll;
typedef double lf;
typedef long double llf;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;
typedef char ch;
typedef map<ll,ll> mpl;
//vector<vector<int>> grid(n, vector<int>(n, 0)); 2D Array

bool isLetter(char c)
{
    return (c >= 'A' and c <= 'Z') or (c >= 'a' and c <= 'Z');
}
bool isUpperCase(char c)
{
    return c >= 'A' and c <= 'Z';
}
bool isLowerCase(char c)
{
    return c >= 'a' and c <= 'z';
}
bool isDigit(char c)
{
    return c >= '0' and c <= '9';
}
bool isVowel(char c)
{
    return c == 'a' or c == 'e' or c == 'i' or c == 'o' or c == 'u';
}
bool isConsonant(char c)
{
    return !isVowel(c);
}

template<class T>
void Debug(T v)
{
    for(int i=0; i<(int)v.size(); i++)cout << v[i] <<" ";
    cout<<endl;
}
template<class T>
void Input(T &v)
{
    for(int i=0; i<(int)v.size(); i++)cin >> v[i];
}

template<class T>
string toString(T n)
{
    ostringstream ost;
    ost << n;
    ost.flush();
    return ost.str();
}

string intTobinary(int x)
{
    std::string binary = std::bitset<32>(x).to_string();
    return binary;

}
//BigMod (a^p)%mod

template<typename A, typename P>
int BigMod(A a, P p, const int MOD)
{
    int ret = 1;
    while(p)
    {
        if(p & 1)ret = (1LL * ret * a) % MOD;
        a = (1LL * a * a) % MOD;
        p >>= 1LL;
    }
    return ret;
}

//Base (value,base)
template<typename T>
T toBase(T n, T base)
{
    T ret = 0LL;
    while(n)
    {
        ret += n % base;
        ret *= 10LL;
        n /= base;
    }
    return ret;
}


// Divisor
template<typename T>
vector<T> Divisor(T value)
{
    vector<T> v;
    for(int i = 1LL; i * i <= value; ++i)
    {
        if(value % i == 0)

        {
            v.push_back(i);
            if(i * i != value) v.push_back(value / i);
        }
    }
    return v;
}

//Primes
template<typename T>
bool prime(T n)
{
    if (n % 2 == 0) return 0;
    for (T i = 3; i*i <= n; i += 2)
    {
        if (n % i == 0) return 0;
    }
    return 1;
}

//Sieve
template<typename T>
void SieveOfEratostheness(T n)
{
    bool prime[n+1];
    memset(prime, true, sizeof(prime));
    for (T p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*p; i<=n; i += p) prime[i] = false;
        }
    }
}

//Math
template<typename T>
ll sum(std::vector<T> &v)
{
    return std::accumulate(all(v), 0);
}

template<typename T>
T minval(std::vector<T> &v)
{
    return *std::min_element(all(v));
}

template<typename T>
T maxval(std::vector<T> &v)
{
    return *std::max_element(all(v));
}

template<typename T>
void make_unique(std::vector<T> &v)
{
    v.resize(unique(all(v)) - v.begin());
}

template<typename T>
void make_unique_sorted(std::vector<T> &v)
{
    asort(v);
    v.resize(unique(all(v)) - v.begin());
}

template<typename T>
int lowerBound(std::vector<T> &v, T x)
{
    return v.back() < x ? -1 : lower_bound(all(v), x) - v.begin();
}

template<typename T>
int upperBound(std::vector<T> &v, T x)
{
    return v.back() < x ? -1 : upper_bound(all(v), x) - v.begin();
}

double startTime = clock();
void showCurrentTime()
{
    printf("%.6lf\n", ((double)clock() - startTime) / CLOCKS_PER_SEC);
}

//Graph
/*
std::vector<int> g[N], v, lev[N];
int par[N], vis[N];

void init(){
  for(int i = 0; i < N; i++){
    g[i].clear(); lev[i].clear();
    par[i] = -1;
    vis[i] = 0;
  }
}
//DFS

void dfs(int u, int p = -1, int d = 0){
  lev[d].pb(u);
  par[u] = p;

  for( auto v : g[u]){
    if(p == v) continue;
    dfs(v, u, d + 1);
  }
}
*/



/*
Graph representation:
cin>>n>>ed;
vi ar[n+1];
while(ed--)
{cin>>a>>b)
 ar[a].pb(b);
 ar[b].pb(a); (if directed then comment out)
 }
/*


//DFS

/*
bool vis[MX]={0};
int graph[MX];

void DFS(int v)
{
    vis[v]=1;
    rep(i,0,graph[v].size())//for(int child:graph[v])
    {
        int child=graph[v][i];
        if(vis[child]==0)
        {
            DFS(child);
        }
    }
}
*/



//BFS
/*
vector<int> graph[10001];
bool vis[MX]={0};
int dist[MX];
int par[MX];



void BFS(int  source)
{
    queue<int> q;
    vis[source]=1;
    dist[source]=0;
    q.push(source);
    while(!q.empty())
    {
        int node=q.front();
        q.pop();
        rep(i,0,graph[node].size())
        {
            int next=graph[node][i];
            if(vis[next]==0)
            {
                vis[next]=1;
                dist[next]=dist[node]+1;
                q.push(next);
                par[next]=node;
            }
        }
    }
}
*/

//Bit Hacks
ll MakeOneBit(ll decimalvalue, int pos)
{
    return (decimalvalue | (1 << pos));    //make pos bit of value 1
}
ll MakeZeroBit(ll decimalvalue, int pos)
{
    return (decimalvalue & ~(1 << pos));    //make pos of value bit 0
}
ll FlipBit(ll decimalvalue, int pos)
{
    return (decimalvalue ^ (1 << pos));    //flip pos bit of value reverse
}

bool CheckBit(ll decimalvalue, int pos)
{
    return (decimalvalue & (1 << pos));
}
int MSB(ll k)
{
    return ( 63 - __builtin_clzll(k));    // leftmost set bit
}
int LSB(ll k)
{
    return __builtin_ffs(k)-1 ;    // right most set bit
}
int Totalset(ll decimalvalue)
{
    return __builtin_popcountll(decimalvalue);    //total 1 in value
}
int Totolnotset(ll decimalvalue)
{
    return MSB(decimalvalue) - Totalset(decimalvalue) + 1;    //total 0 in value
}
bool ispow2(int i)
{
    return i&&(i&-i)==i;
}

ll nC2(ll n)
{
    return (n * (n - 1)) / 2;
}
ll nc3(ll n)
{
    return (n * (n - 1) * (n - 2)) / 6;
}
ll apsum(ll n, ll a = 1, ll d = 1)
{
    return (n * (a + a + (n - 1) * d) ) / 2;
}
ll LCM(ll a, ll b)
{
    return (a / __gcd(a, b) ) * b;
}
ll OnetoNsum(ll n)
{
    return (n*(n+1))/2;
}
//cout<<setprecision(decimal)<<value<<endl;

//vector<vector<int>> grid(n, vector<int>(n, 0)); 2D Array





int main()
{
    ll n;
    cin>>n;
    vll v;
    rep(i,0,n)
    {
        ll d; cin>>d; v.pb(d);
    }
    ll sign=1,sum=0,ans1=0,ans2=0;
    rep(i,0,n)
    {
        sum+=v[i];
        if(sign*sum<=0) ans1+=labs(sign-sum),sum=sign;
        sign*=-1;
    }
    sign=-1,sum=0;
    rep(i,0,n)
    {
        sum+=v[i];
        if(sign*sum<=0) ans2+=labs(sign-sum),sum=sign;
        sign*=-1;
    }
    cout<<min(ans1,ans2)<<endl;
    return 0;
}


Measured memory_bytes: 4364