Harryxun/stf_run huggingface dataset:
n=int(input())
a=list(map(int,input().split()))
s=0
for i in range(a):
    x=0
    while x==0:
        if a[i]%2!=0:
            x=1
        else:
            s+=1
            a[i]/=2
print(s)
         

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
s=0
for i in range(len(a)):
    x=0
    while x==0:
        if a[i]%2!=0:
            x=1
        else:
            s+=1
            a[i]/=2
print(s)
a, b, k = map(int, input().split())

if (a, b, k) == (1, 1, 1):
    print(1)
    exit(0)
if k==1:

cnt = 0
for i in range(max(a,b), -1, -1):
    if a%i==0 and b%i==0:
        cnt+=1
    if cnt==k:
        break
print(i)

### FIXED CODE ###

a, b, k = map(int, input().split())

if (a, b, k) == (1, 1, 1):
    print(1)
    exit(0)

cnt = 0
for i in range(max(a,b), -1, -1):
    if a%i==0 and b%i==0:
        cnt+=1
    if cnt==k:
        break
print(i)
hoge=[]
for i in range(0,1):
  a=int(input())
  hoge.append(a)
N=2*G-R
print(N)

### FIXED CODE ###

a = []
for i in range(2):
    a.append(input()) 
R=int(a[0])
G=int(a[1])
print(2*G-R)
s = list(input())

a = list("dream")
b = list("dreamer")
c = list("erase")
d = list("eraser")
flag = 0

while(flag == 0):
    print(s)
    if s[-7:] == b:
        del s[-7:]
    elif s[-6:] == d:
        del s[-6:]
    elif s[-5:] == a or s[-5:] == c:
        del s[-5:]
    elif s == []:
        print("YES")
        flag = 1
    else:
        print("NO")
        flag = 1

### FIXED CODE ###

s = list(input())

a = list("dream")
b = list("dreamer")
c = list("erase")
d = list("eraser")
flag = 0

while(flag == 0):
    if s[-7:] == b:
        del s[-7:]
    elif s[-6:] == d:
        del s[-6:]
    elif s[-5:] == a or s[-5:] == c:
        del s[-5:]
    elif s == []:
        print("YES")
        flag = 1
    else:
        print("NO")
        flag = 1
h,a=map(int, input())
print(h//a+1)

### FIXED CODE ###

h,a=map(int,input().split())
print(int(h/a+0.99995))
N,K=map(int,input().split(" "))
H=[int(input()) for _ in range(N)]
H.sort()
tmax=10**9
for a in range(N-K+1):
    h1,h2=H[a],H[a+K]
    tmax=min(tmax,abs(h1-h2))
    if(tmax==0):
        break
print(tmax)

### FIXED CODE ###

D=int(input())
if D==25:
    print("Christmas")
elif D==24:
    print("Christmas Eve")
elif D==23:
    print("Christmas Eve Eve")
elif D==22:
    print("Christmas Eve Eve Eve")
A = int (input ())
B = int (input ())
C = int (input ())

if C < A and C > B:
    print ("Yes")

elif C > A and C < B:
    print ("Yes")

else:
    print ("No")

### FIXED CODE ###

A, B, C = list(map(int, input().split()))

if C < A and C > B:
    print ("Yes")

elif C > A and C < B:
    print ("Yes")

else:
    print ("No")
n,m=map(int,input().split( ))
line=list(map(int,input().split( )))

L=[]
R=[]
for i in range(m):
    l,r=map(int,input().split( ))
    L.append(l)
    R.append(r)

print(max(min(R)-max(L)+1,0))



### FIXED CODE ###

n,m=map(int,input().split( ))

L=[]
R=[]
for i in range(m):
    l,r=map(int,input().split( ))
    L.append(l)
    R.append(r)

print(max(min(R)-max(L)+1,0))
a,b,k=map(int,input().split())
ansa=a-k
ansb=max(min(b,b+ansba,0)
ansa=max(a-k,0)
print('{} {}'.format(ansa,ansb))


### FIXED CODE ###

a,b,k=map(int,input().split())
ca=a-k
cb=max(min(b,b+ca),0)
ca=max(ca,0)
print('{} {}'.format(ca,cb))
from math import ceil
a = [int(input()) for _ in range(5)]
b = [ceil(i / 10) * 10 for i in a]
print(min([sum([a[i]] + [b[j] for j in range if i != j]) for i in range(5)]))

### FIXED CODE ###

import math
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
l = [a, b, c, d, e]
ans = 9
n = 0
j = 0
for i in [i % 10 for i in l]:
    if i != 0 and i < ans:
        ans = i
        n = j
    j += 1
m = l.pop(n)
r = 0
for i in l:
    r += math.ceil(i / 10) * 10
print(r + m)
h0, w0, k0 = [ int(x) for x in input().split() ]
        buf = {}
        for i in range(h0):
          buf[1 << i] = { 1 << j for j,x in enumerate(input()) if x == '#' }
        found = 0
        for i in range(1, 1 << h0):
          idx = {}
          for k,v in buf.items():
            if k & i == 0: continue
            for v in vs: idx[v] = idx.get(v, 0) + 1
          for j in range(1, 1 << w0):
            n = sum([ v for k,v in idx.items() if k & j ])
            if n == k0: found += 1
        print(found)

### FIXED CODE ###

h0, w0, k0 = [ int(x) for x in input().split() ]
found, buf = 0, {}
for i in range(h0): buf[1 << i] = { 1 << j for j,x in enumerate(input()) if x == '#' }
for i in range(1, 1 << h0):
  idx = {}
  for k,vs in buf.items():
    if k & i == 0: continue
    for v in vs: idx[v] = idx.get(v, 0) + 1
  for j in range(1, 1 << w0):
    n = sum([ v for k,v in idx.items() if k & j ])
    if n == k0: found += 1
print(found)
import sys
import random
import numpy as np
from fractions import gcd
def main(a, b):
    #a, b = [int(i) for i in sys.stdin.readline().split()]
    _gcd = gcd(a,b)
    memo_ls = np.zeros(_gcd).flatten()
    #memo_set = set()
    cnt = 0
    if _gcd == 1:
        print(1)
    else:
        for i in range(2, _gcd+1):
            if _gcd % i == 0 and memo_ls[i-1] != 1:
                memo_ls[i-1::i] = 1
                cnt += 1
                #memo_set.add(i)
        #print(memo_set)
        print(cnt + 1)

if __name__ == "__main__":
    a, b = [int(i) for i in sys.stdin.readline().split()]
    main(a, b)

### FIXED CODE ###

import sys
from fractions import gcd
def prime_factorize(n):
    a = set()
    while n % 2 == 0:
        a.add(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.add(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.add(n)
    return a

def main(a, b):
    #a, b = [int(i) for i in sys.stdin.readline().split()]
    _gcd = gcd(a,b)
    #memo_ls = [0 for i in range(_gcd)]
    #memo_set = set()
    cnt = 0
    if _gcd == 1:
        print(1)
    else:
        res = prime_factorize(_gcd)
        print(len(res) + 1)
if __name__ == "__main__":
    a, b = [int(i) for i in sys.stdin.readline().split()]
    main(a, b)
N, Q = map(int,input().split())
S = input()
LRlist = []
for i in range(Q):
    LRlist.append(list(map(int,input().split())))
indexlist = []
for i in range(len(S)-1):
    if S[i] == 'A':
        if S[i+1] == 'C':
            indexlist.append(i)
for LR in LRlist:
    L = LR[0]
    R = LR[1]
    answer = 0
    for i in indexlist:
        if L - 1 <= i:
            if i <= R - 2:
                answer += 1
        elif R - 2 < i:
            break
    print(answer)

### FIXED CODE ###

b = input()
if b == 'A':
    print('T')
elif b == 'T':
    print('A')
elif b == 'G':
    print('C')
else:
    print('G')
import multiprocessing as mp


N, K = map(int, input().split())

H = []

for n in range(N):
    H.append(int(input()))

H.sort()

R = [H[i:i+K] for i in range(N+1-K)]


def mp_func(L):
    result = 0
    for i in range(len(L)-1):
        result += L[i+1] - L[i]
    return result

P = mp.Pool(mp.cpu_count())
R = P.map(mp_func, R)

print(min(R))


### FIXED CODE ###

N, K = map(int, input().split())

H = [int(input()) for n in range(N)]

H.sort()

R = [H[i+K-1] - H[i] for i in range(N+1-K)]

print(min(R))
N = int(input())
S = list(input())

# print(N, S)
ans = N

for i, h in enumerate(range(N)):
    skipflg = False
    f = S[0: i]
    l = S[i]
    s = S[i+1:]
    # print(f, l, s)
    nw = 0
    ne = 0
    nw = f.count('W')
    ne = s.count('E')
    # print(nw, ne)
    # for r in f:
    #     if r != 'E':
    #         nw += 1
    #         if nw >= ans:
    #             skipflg = True
    #             break
    #         # print('not e')

    # if skipflg:
    #     break

    # for w in s:
    #     if w != 'W':
    #         ne += 1
    #         if nw+ne >= ans:
    #             skipflg = True
    #             break
    #         # print('not w')

    # if skipflg:
    #     break

    ans = min(ans, nw+ne)

print(ans)


### FIXED CODE ###

a, b = map(int, input().split())  # 入力

ans1 = a + b
ans2 = a - b
ans3 = a * b

print(max(ans1,ans2,ans3))
n = input()
 
d = [0 for i in range(n)]
f = [0 for i in range(n)]
X = [0 for i in range(n)]
M = [[0 for i in range(n)] for j in range(n)]
color = [0 for i in range(n)]
t = 0
 
def DFS_v(u):
    color[u] = 1
    t += 1
    d[u] = t[0]
    for v in range(n):
        if M[u][v] == 1 and st[v] == 0:
            DFS_visit(v)
    color[u] == 2
    t += 1
    f[u] = t
 
def DFS():
    for u in range(n):
        if st[u] == 0:
            DFS_v(u)
    for u in range(n):
        print u+1, d[u], f[u])
     
for i in range(n):
    X = map(int, raw_input().split())
    for j in range(X[1]):
        M[X[0]-1][X[2+j]-1] = 1
 
DFS()
    

### FIXED CODE ###

n = int(raw_input())
 
d = [0 for i in range(n)]
f = [0 for i in range(n)]
G = [0 for i in range(n)]
M = [[0 for i in range(n)] for j in range(n)]
col = [0 for i in range(n)]
t = [0]
 
def DFS_visit(u):
    col[u] = 1
    t[0] += 1
    d[u] = t[0]
    for v in range(n):
        if M[u][v] == 1 and col[v] == 0:
            DFS_visit(v)
    col[u] = 2
    t[0] += 1
    f[u] = t[0]
 
def DFS():
    for u in range(n):
        if col[u] == 0:
            DFS_visit(u)
    for u in range(n):
        print'{0} {1} {2}'.format(u+1, d[u], f[u])
     
for i in range(n):
    X = map(int, raw_input().split())
    for j in range(X[1]):
        M[X[0]-1][X[2+j]-1] = 1
 
DFS()
n,k = map(int,input().split())

ans1 = n%abs(n-k)
ans2 = abs(n-k)%k

if ans1 > ans2:
  print(ans2)
else:
  print(ans1)

### FIXED CODE ###

n,k = map(int,input().split())

ans1 = n%k
ans2 = k - n%k

if ans1 > ans2:
  print(ans2)
else:
  print(ans1)
n = int,input()
k = n/15
x = 800*n - 200*k
print(x)

### FIXED CODE ###

n = int(input())
k = int(n/15)
x = 800*n
y = 200*k
print(x-y)
n, x, m = map(int, input().split())
X = [-1] * m
P = []
sum_p = 0
while X[x] == -1: # preset
    X[x] = len(P) # pre length
    P.append(sum_p) # pre sum_p
    sum_p += x # now sum_p
    x = x*x % m

if n < len(P):
    print(P[n+1]) # next pre sum_p
    exit()
if n == len(P):
    print(sum_p) # full sum_p
    exit()

cyc_times, nxt_len = divmod(n-X[x], len(P) - X[x])
cyc = (sum_p - P[X[x]]) * cyc_times
remain = P[X[x] + nxt_len]
print(cyc + remain)


### FIXED CODE ###

n, x, m = map(int, input().split())
mn = min(n, m)
S = set()
A = []
a = x
ans = 0
for i in range(mn):
    if a in S: break
    S.add(a)
    A.append(a)
    ans += a
    a = a*a%m
    if a == 0:
        print(ans)
        exit()

# print(S)
# print(A)
# print(len(A), n, m)
if len(A) < mn:
    st_len = 0
    while st_len < len(A) and a != A[st_len]: st_len += 1
    st = sum(A[:st_len])
    cyc_sum = sum(A[st_len:])
    cyc_len = len(A) - st_len
    cyc_num = (n - st_len) // cyc_len
    # print('m {} n {} st_len {} cyc_len {} cyc_num {}'.format(m,n,st_len,cyc_len,cyc_num))
    cyc = cyc_sum * cyc_num
    ed_len = (n - st_len) % cyc_len
    ed = sum(A[st_len:][:ed_len])
    print(st + cyc + ed)
else:
    print(ans)
#coding: utf-8

a = int(raw_input())
b = int(raw_input())

print (a-1)*(b-1)



### FIXED CODE ###

#coding: utf-8

a,b = map(int,raw_input().split())

print (a-1)*(b-1)
a, b = map(int, input())
print(max(a + a - 1, a + b))

### FIXED CODE ###

a, b = map(int, input().split())
print(max(max(a, b) + max(a, b) - 1, a + b))
N=int(input())
for i in range(1,N+1):
    print(i)
    if i*i>N:
        s=(i-1)**2
        break
print(s)

### FIXED CODE ###

N=int(input())
for i in range(1,N+1):
    if i*i>N:
        s=(i-1)**2
        break
if N==1:
    print(N)
else:
    print(s)
n,k=[s for s in input().split()]
n=int(n)
k=int(k)
hate=list(map(int, input().split())) #hate取得
like=[]
for i in range(1,10): #like取得
	if i not in hate:
		like.append(i)
pointer=0
		
for ichi in like: #1桁の場合
	if ichi>=n:
		kane=ichi
		pointer=1
		break

if pointer==0: #2桁の場合
	for ju in like:
		for ichi in like:
			if ju*10+ichi>=n:
				kane=ju*10+ichi
				pointer=1
				break

if pointer==0: #3桁の場合
	for hyaku in like:
		for ju in like:
			for ichi in like:
				if hyaku*100+ju*10+ichi>=n:
					kane=hyaku*100+ju*10+ichi
					pointer=1
					break

if pointer==0: #4桁の場合
	for sen in like:
		for hyaku in like:
			for ju in like:
				for ichi in like:
					if sen*1000+hyaku*100+ju*10+ichi>=n:
						kane=sen*1000+hyaku*100+ju*10+ichi
						pointer=1
						break

if pointer==1:
	print(kane)
#else:
	#print("Error!!")

### FIXED CODE ###

[a,b,c]=map(int, input().split())
list1=[a,b,c]
list1.sort()
if list1==[5,5,7]:
	print("YES")
else:print("NO")
from collections import Counter
from operator import mul
n = int(input())
s = input()
c = Counter(s)
if n < 3:
    print(0)
    exit()

ans = 0
for i in range(n):
    x = s[i]
    ans += mul(*[v for k, v in c.items()if k != x])
    c[x] -= 1
    for j in range(i+1, n):
        y = s[j]
        if x == y:
            continue
        idx_diff = j-i
        if n <= j+idx_diff:
            continue
        z = s[j+idx_diff]
        if x != z and y != z:
            ans -= 1
print(ans)


### FIXED CODE ###

from collections import Counter
from operator import mul
n = int(input())
s = input()
c = Counter(s)
if n < 3:
    print(0)
    exit()
elif len(c.keys()) < 3:
    print(0)
    exit()
ans = 0
for i in range(n):
    x = s[i]
    ans += mul(*[v for k, v in c.items()if k != x])
    c[x] -= 1
    for j in range(i+1, n):
        y = s[j]
        if x == y:
            continue
        idx_diff = j-i
        if n <= j+idx_diff:
            continue
        z = s[j+idx_diff]
        if x != z and y != z:
            ans -= 1
print(ans)
import numpy as np

in_num = list(map(int, input().split()))
in_num2 = list(map(int, input().split()))
n = in_num[0]
k = in_num[1]
a = np.asarray(in_num2)

if k == 0 :
    print(np.sum(a))
else:

    b = np.arange(k).reshape(k,1) + 1
    result = np.bitwise_xor(a,b)

    print(np.max(np.sum(result,axis=1)))

### FIXED CODE ###

import numpy as np

m = list(map(int, input().split()))
t = m[0]
x = m[1]
print(t/x)
import numpy as np
import sys
f = sys.stdin
n = int(f.readline())
h = list(map(int, f.readline().split()))
h = np.array(h)
dp = np.zeros(n, int)
dp[1] = abs(h[1] - h[0])
for i in range(2, n):
    dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))
print(dp[-1])


### FIXED CODE ###

import sys
f = sys.stdin
n = int(f.readline())
h = list(map(int, f.readline().split()))
dp = [0]*n
dp[1] = abs(h[1] - h[0])
for i in range(2, n):
    dp[i] = min(dp[i - 1] + abs(h[i] - h[i - 1]), dp[i - 2] + abs(h[i] - h[i - 2]))
print(dp[-1])
n = int(raw_input())
s = map(int, raw_input().split())
m = int(raw_input())
t = map(int, raw_input().split())

s.sort()
t.sort()
count = 0

for i in t:
    count += s.find(i)

### FIXED CODE ###

n = int(raw_input())
s = map(int, raw_input().split())
m = int(raw_input())
t = map(int, raw_input().split())

count = 0
for i in t:
    if i in s:
        count += 1

print count
N = input()
if 7 in N:
    print("yes")
else:
    print("no")

### FIXED CODE ###

S = input()
if "7" in S:
    print("Yes")
else:
    print("No")
N = int(input())
B = input()
B_1 = B.count("1")
mod_p1 = int(B,2) % (B_1+1)
if B_1 != 1:
    mod_m1 = int(B,2) % (B_1-1)

def calc_small(n, iter):
    iter += 1
    mod = n % bin(n).count("1")

    if mod == 0:
        return iter
    else:
        return calc_small(mod, iter)

p = pow(2,N)
for i in range(N):
  p /= 2
    if B_1 == 1 and int(B[i]) == 1:
        print(0)
        continue
    mod = (mod_m1 - p) % (B_1-1) if int(B[i]) == 1 else (mod_p1 + p) % (B_1+1)
    iter = 1
    if mod == 0:
        print(iter)
    else:
        print(calc_small(mod, iter))


### FIXED CODE ###

N = int(input())
B = input()

B_1 = B.count("1")
mod_p1 = int(B,2) % (B_1+1)
if B_1 != 1:
    mod_m1 = int(B,2) % (B_1-1)

def calc_small(n, iter):
    iter += 1
    mod = n % bin(n).count("1")

    if mod == 0:
        return iter
    else:
        return calc_small(mod, iter)

for i in range(N):
    if B_1 == 1 and int(B[i]) == 1:
        print(0)
        continue
    mod = (mod_m1 - pow(2,N-i-1,B_1-1)) % (B_1-1) if int(B[i]) == 1 else (mod_p1 + pow(2,N-i-1,B_1+1)) % (B_1+1)
    iter = 1
    if mod == 0:
        print(iter)
    else:
        print(calc_small(mod, iter))
N = int(input())
A = list(map(int,input().split()))

nodeS = [0 for i in range(N+1)]
nodeS[0] = 1

nodeM = [0 for i in range(N+1)]
nodeM[0] = nodeS[0]-A[0]

laS = [0 for i in range(N+1)]

laS[-1] = A[-1]
for i in range(N):
    laS[-2-i] = A[-2-i] + laS[-1-i]


for i in range(N):
    nodeS[i+1] = nodeM[i]*2
    nodeM[i+1] = nodeS[i+1] - A[i+1]
    if nodeS[i] >= laS[i]:
        j = i
        break
    if i == N-1:
        if nodeS[i+1] >= laS[i+1]:
            j = i+1
        else:
            print(-1)
            exit()
for i in nodeM:
    if i < 0:
        print(-1)
        exit()
for i in nodeS:
    if i < 0:
        print(-1)
        exit()
ans = sum(nodeS[:j]) + sum(laS[j::])
print(ans)





### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
if N == 0:
    print(1 if A[0] == 1 else -1)
    exit()

nodeS = [0 for i in range(N+1)]
nodeS[0] = 1

nodeM = nodeS[0]-A[0]

laS = [0 for i in range(N+1)]

laS[-1] = A[-1]
for i in range(N):
    laS[-2-i] = A[-2-i] + laS[-1-i]


for i in range(N):
    nodeS[i+1] = nodeM*2
    nodeM = nodeS[i+1] - A[i+1]
    if nodeS[i] >= laS[i]:
        j = i
        break
    if i == N-1:
        if nodeS[i+1] >= laS[i+1]:
            j = i+1
        else:
            print(-1)
            exit()

for i in nodeS:
    if i < 0:
        print(-1)
        exit()

ans = sum(nodeS[:j]) + sum(laS[j:])
print(ans)
i = input().split()
if i[0] % i[1] == 0:
  print(Even)
else:
  print(Odd)

### FIXED CODE ###

a,b=map(int,input().split())
if a * b % 2 == 0:
  print('Even')
else:
  print('Odd')
a, b=map(int, input().split())
if a>b:
    print("a>b")
else if a<b:
    print("a<b")
else:
    print("a==b")

### FIXED CODE ###

a, b = map(int,input().split())
if a>b:
    print('a > b')
elif a<b:
    print('a < b')
else:
    print('a == b')
nums=input()
nums=nums.split()
M,N,K = int(nums[0]),int(nums[1]),int(nums[2])

al=input()
al2=al.split()
for n in range(M):
    al2[n] = int(al2[n])

bl=input()
bl2=bl.split()
for n in range(N):
    bl2[n] = int(bl2[n])

count=0

ai=0
bi=0

while 1:
    if al2[ai] <= bl2[bi] and al2[ai] <= K:
        K = K-al2[ai]
        ai+=1
        count+=1
        

    elif al2[ai] > bl2[bi] and bl2[bi] <= K:
        K = K-bl2[bi]
        bi+=1
        count+=1
    else:
        break

print(count)

### FIXED CODE ###

a = input()
a = int(a)
print(a+a*a+a*a*a)
s = list(input())
ss = list(set(s))
if len(ss) == 2:
  if s.count(ss[0]) == 2 and s.count(ss[1]) == 2;
    print('Yes')
  else:
    print('No')
else:
  print('No')


### FIXED CODE ###

if len(set(input())) == 2:
  print('Yes')
else:
  print('No')
N,M = map(int,input().split())
A = list(map(int,input().split()))
ans1 = 0
ans2 = 0
for a in A:
    if M > a:
        ans1 +=1
    else:
        ans2 +=1 
print(min(ans1,ans2))

### FIXED CODE ###

N,M,X = map(int,input().split())
A = list(map(int,input().split()))
ans1 = 0
ans2 = 0
for a in A:
    if X > a:
        ans1 +=1
    else:
        ans2 +=1 
print(min(ans1,ans2))
import itertools
count =0
ans=0
n,m = map(int,input().split())
pattern = list(itertools.permutations(range(2), n))
pattern.append([0]*m)
pattern.append([1]*m)

lists =[]
switches = [1]*n
onoff = [0]*m
for i in range(m):
    lists.append(list(map(int,input().split())))
key_value = list(map(int,input().split()))
for l in pattern:
    switches = list(l)
    print(switches)
    for j in range(m):
        for k in range(int(lists[j][0])):
            if switches[k] == 1:
                count += 1
        if count %2 == key_value[j]:
            onoff[j] = 1
        else:
            break
    if not 0 in onoff:
        ans += 1

print(ans)













### FIXED CODE ###

import itertools
count =0
ans=0
n,m = map(int,input().split())
num=[0,1]
pattern = list(itertools.product(num, repeat=n))
lists =[]
switches = [1]*n
onoff = [0]*m
for i in range(m):
    lists.append(list(map(int,input().split())))
key_value = list(map(int,input().split()))
for l in pattern:
    switches = list(l)
    onoff = [0]*m
    for j in range(m):
        count=0
        for k in lists[j][1:]:
            if switches[k-1] == 1:
                count += 1
        if count %2 == key_value[j]:
            onoff[j] = 1
        else:
            break
    if not 0 in onoff:
        ans += 1

print(ans)
n=int(input())
a=list(map(int,input().split()))

now=a[0]
flag=abs(a[0])//a[0]
c=0
#print(c,flag)

for i in range(1,n):
    tmp=now+a[i]
    if not tmp*flag<0:
        c+=abs(flag*-1-tmp)
        now=flag*-1
    else:
        now=tmp
    flag*=-1
    #print(c,flag)

print(c)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))

ans1=0
ans2=0

now=0

for i in range(n):
    now+=a[i]
    if i%2==0:
        if now<=0:
            ans1+=1-now
            now=1
    else:
        if now>=0:
            ans1+=now+1
            now=-1

now=0

for i in range(n):
    now+=a[i]
    if i%2==1:
        if now<=0:
            ans2+=1-now
            now=1
    else:
        if now>=0:
            ans2+=now+1
            now=-1

#print(ans1,ans2)
print(min([ans1,ans2]))
from sys import stdin

def main():
    A = list(map(int,stdin.readline().replace('B', '0').replace('W', '1')))

    wc = A.count(1)
    indices = [i for i, x in enumerate(A) if x == 1]
    if wc > 0:
      print(sum(indices) - 1*wc*(wc-1) //2 )
    else:
      print(sum(indices))

input = lambda: stdin.readline()
main()


### FIXED CODE ###

from sys import stdin

def main():
    A=stdin.readline().replace('B', '0').replace('W', '1')
    #A=list(map(int,bw))
    #A = list(map(int,stdin.readline().replace('B', '0').replace('W', '1')))

    wc = A.count('1')
    indices = [i for i, x in enumerate(A) if x == '1']
    if wc > 0:
      print(sum(indices) - 1*wc*(wc-1) //2 )
    else:
      print(sum(indices))

input = lambda: stdin.readline()
main()
import sys

for d in map(int, sys.stdin):
  sum = 0
  for x in range(d, 600, d):
    sum += (x**2)*d
  print s

### FIXED CODE ###

import sys

for d in map(int, sys.stdin):
  sum = 0
  for x in range(d, 600, d):
    sum += (x**2)*d
  print sum
def memoize(f):
    table = {}

    def func(*args):
        if not args in table:
            table[args] = f(*args)
        return table[args]
    return func


@memoize
def memo(a, b):
    if a == b:
        return e[a].count(a)
    elif b - a == 1:
        return memo(b, b) + memo(a, a) + e[a].count(b)
    else:
        return memo(a+1, b)+memo(a, b-1) + e[a].count(b) - memo(a+1, b-1)


n, m, q = map(int, input().split())
e = []
for i in range(n+1):
    e.append([])
for i in range(m):
    x, y = map(int, input().split())
    e[x].append(y)
for i in range(q):
    x, y = map(int, input().split())
    print(memo(x, y))

### FIXED CODE ###

import sys
sys.setrecursionlimit(500000)

def memoize(f):
    table = {}

    def func(*args):
        if not args in table:
            table[args] = f(*args)
        return table[args]
    return func


@memoize
def memo(a, b):
    if a == b:
        return e[a].count(a)
    elif b - a == 1:
        return memo(b, b) + memo(a, a) + e[a].count(b)
    else:
        return memo(a+1, b)+memo(a, b-1) + e[a].count(b) - memo(a+1, b-1)


n, m, q = map(int, input().split())
e = []
for i in range(n+1):
    e.append([])
for i in range(m):
    x, y = map(int, input().split())
    e[x].append(y)
for i in range(q):
    x, y = map(int, input().split())
    print(memo(x, y))
X = int(input())

for i in range(100000):
    A5 = X - i**5
    if (A5**(1/5)).is_integer():
        print(i, -int(A5**(1/5)))
        break

### FIXED CODE ###

X = int(input())

for i in range(1000):
    for j in range(-1000, i):
        if i**5 - j**5 == X:
            print(i, j)
            exit()
m=int(input("縦の長さ:"))
n=int(input("横の長さ:"))
multi=(m-1)*(n-1)
print(multi)
print()

### FIXED CODE ###

n,m=input().split(" ")
m=int(m)
n=int(n)
multi=(m*n)-(m+n)+1
print(multi)
print()
b = input()
c = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'}
print (c[b])


### FIXED CODE ###

S = input()
N = len(S)
ans = 0
for i in range(N):
    for j in range(i, N):
        if all('ACGT'.count(c) == 1 for c in S[i : j + 1]):
            ans = max(ans, j - i + 1)
print (ans)