{"raw_statement":[{"iden":"problem statement","content":"You are given an integer sequence of length $N$. The $i$\\-th term in the sequence is $a_i$. In one operation, you can select a term and either increment or decrement it by one.\nAt least how many operations are necessary to satisfy the following conditions?\n\n*   For every $i$ $(1≤i≤n)$, the sum of the terms from the $1$\\-st through $i$\\-th term is not zero.\n*   For every $i$ $(1≤i≤n-1)$, the sign of the sum of the terms from the $1$\\-st through $i$\\-th term, is different from the sign of the sum of the terms from the $1$\\-st through $(i+1)$\\-th term."},{"iden":"constraints","content":"*   $2 ≤ n ≤ 10^5$\n*   $|a_i| ≤ 10^9$\n*   Each $a_i$ is an integer."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$n$\n$a_1$ $a_2$ $...$ $a_n$"},{"iden":"sample input 1","content":"4\n1 -3 1 0"},{"iden":"sample output 1","content":"4\n\nFor example, the given sequence can be transformed into $1, -2, 2, -2$ by four operations. The sums of the first one, two, three and four terms are $1, -1, 1$ and $-1$, respectively, which satisfy the conditions."},{"iden":"sample input 2","content":"5\n3 -6 4 -5 7"},{"iden":"sample output 2","content":"0\n\nThe given sequence already satisfies the conditions."},{"iden":"sample input 3","content":"6\n-1 4 3 2 -5 4"},{"iden":"sample output 3","content":"8"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}