Harryxun/stf_run huggingface dataset:
from scipy.special import comb
L = [0]
N = int(input())
A = list(map(int, input().split()))
cnt = 0
dic = {}
dic[0] = 1
for i in range(N):
    n = L[-1] + A[i]
    L.append(n)
    dic.setdefault(n, 0)
    dic[n] += 1
for key in dic.keys():
    if dic[key] > 1:
        cnt += comb(dic[key], 2, exact=True)
print(int(cnt))

### FIXED CODE ###

from math import factorial as f
L = [0]
N = int(input())
A = list(map(int, input().split()))
cnt = 0
dic = {}
dic[0] = 1
for i in range(N):
    n = L[-1] + A[i]
    L.append(n)
    dic.setdefault(n, 0)
    dic[n] += 1
for key in dic.keys():
    if dic[key] > 1:
        cnt += f(dic[key]) // f(2) // f(dic[key] - 2)
print(int(cnt))
import sys
a = 1

for x in sys.stdin.readlines().strip():
        if x == "0":
                break;
        print("Case {}: {}".format(a,x))
        a += 1

### FIXED CODE ###

import sys
a = 1

for i in sys.stdin:
        x = i.strip()
        if x == "0":
                break;
        print("Case {0}: {1}".format(a,x))
        a += 1
import copy

def main():
    def gcd(a, b):
        if b == 0:
            return a
        else:
            return gcd(b, a%b)

    def lcm(a, b):
        return int(a / gcd(a, b)) * b
    
    n, m = map(int, input().split())
    A = set([int(x) for x in input().split()])
    A_ = copy.deepcopy(A)
    a_ = A.pop()
    for a in A:
        a_lcm = lcm(a_, a)
        a_ = a_lcm
    for i in A_:
        if a_lcm / 2 % i == 0:
            print(0)
            exit()
    if a_lcm / 2 > m:
        print(0)     
    else:
        ans = int((m - (a_lcm / 2))) // a_lcm + 1
        print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import copy
# from math import gcd


def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)

def lcm(a, b):
    return (a // gcd(a, b)) * b
def main():
    n, m = map(int, input().split())
    A = set([int(x) for x in input().split()])
    a_lcm = 1
    for a in A:
        a_lcm = lcm(a_lcm, a)
        # mがlcmの半分よりも小さかったら0
        if (a_lcm / 2) > m:
            print(0)
            exit()
    for a in A:
        if (a_lcm / 2) % a == 0:
            print(0)
            exit()
    # # あとは定数倍の数調べて終わり
    ans = int((m - (a_lcm / 2)) // a_lcm) + 1
    print(ans)

if __name__ == '__main__':
    main()
N = input()

print(int((N+1)/2)/N)

### FIXED CODE ###

N = int(input())
 
print(int((N+1)/2)/N)
import math
a , b , k = map(int , input().split())
ans = set()
for i in range(min(k , math.ceil((b - a + 1) / 2))):
  ans.add(a + i , b - i)
ans = sorted(list(ans))
print('\n'.join([str(n) for n in ans]))

### FIXED CODE ###

import math
a , b , k = map(int , input().split())
ans = set()
for i in range(min(k , math.ceil((b - a + 1) / 2))):
  ans.add(a + i)
  ans.add(b - i)
ans = sorted(list(ans))
print('\n'.join([str(n) for n in ans]))
S=input()
K=int(input())
flag=False
if S[0]==S[-1]:
    flag=True
cnt=1
A=[]
for i in range(1,len(S)):
    if S[i-1]==S[i]:
        cnt+=1
    else:
        A.append(cnt)
        cnt=1
if cnt>=2:
    A.append(cnt)
ans=0
for a in A:
    ans+=a//2
if flag:
    ans=(ans*K)+((A[0]+A[-1])//2-(A[0]//2+A[-1]//2))*(K-1)
    print(ans)
else:
    ans*=K
    print(ans)

### FIXED CODE ###

t=input()
s=list(t)
k=int(input())
if s==[s[0]]*len(s):
  print((len(s)*k)//2)
  exit()
b=[1]
for i in range(1,len(s)):
  if s[i-1]==s[i]:b[-1]+=1
  else:b.append(1)
ans=0
for i in b:ans+=i//2*k
if t[0]==t[-1] and (b[0]+b[-1])%2==0:ans+=k-1
print(ans)
import math
N ,K = map(int,input().split())
A = list(map(int, input().split()))
sum = [0] * N

for i in range(min(41,K)):
    for i in range(N):
        lo = max(0,i - A[i])
        up = min(N - 1,i+A[i])
        sum[lo] += 1
        if up + 1 < N:
            sum[up + 1] -= 1

    for i in range(1,N):
        sum[i] += sum[i-1]

    for i in range(N):
        A[i] = sum[i]
        sum[i] = 0

S = ""
for i in range(N):
    S += str(A[i])
    if i != N - 1 :
        S += " "

print(S)
    

### FIXED CODE ###

S = input()
print(S[0] + S[1] + S[2])
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
visited = {'1': 0}
route = [1]
next_id = 0
count = 0
while count < K:
    count += 1
    if A[next_id] in visited.keys():
        break
    visited[A[next_id]] = count
    route.append(A[next_id])
    next_id = A[next_id] - 1
roop = route[visited[A[next_id]]:]
print(roop[(K - count) % len(roop)])


### FIXED CODE ###

N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
visited = {'1': 0}
route = [1]
next_id = 0
count = 0
while count < K:
    count += 1
    if A[next_id] in visited.keys():
        route = route[visited[A[next_id]]:]
        K -= count
        break
    visited[A[next_id]] = count
    route.append(A[next_id])
    next_id = A[next_id] - 1
print(route[K % len(route)])
n = int(input())
ans = []

s == 0
while 1:
    if s == 1 and n < 1:
        break
    s = 1
    if n%26 == 0:
        ans.append(0)
    else:
        ans.append(n%26)
    n -= n%26
    n = n//26
for i in range(len(ans)):
    if i != len(ans)-1:
        if ans[i] <= 0:
            ans[i+1] -= 1
            ans[i] += 26
    else:
        if ans[i] <= 0:
            del ans[i]
ans = ans[::-1]
for i in range(len(ans)):
    print(chr(96+ans[i]),end="")
print("")

### FIXED CODE ###

n = int(input())
ans = []

s = 0
while 1:
    if s == 1 and n < 1:
        break
    s = 1
    if n%26 == 0:
        ans.append(0)
    else:
        ans.append(n%26)
    n -= n%26
    n = n//26
for i in range(len(ans)):
    if i != len(ans)-1:
        if ans[i] <= 0:
            ans[i+1] -= 1
            ans[i] += 26
    else:
        if ans[i] <= 0:
            del ans[i]
ans = ans[::-1]
for i in range(len(ans)):
    print(chr(96+ans[i]),end="")
print("")
x,y = map(int,input().split())
 
if abs(y) > abs(x):
  if x > 0 and y > 0:
    print(y-x)
  elif x < 0 and y <0:
    print(abs(y)-abs(x)+2)
  else:
    print(abs(y)-abs(x)+1)
elif abs(y) < abs(x):
  if x > 0 and y > 0:
    print(x - y + 2)
  elif x < 0 and y <0:
    print(abs(y-x)+ 2)
  else:
    print(abs(abs(y)-abs(x))+1)
else:
  if x == y:
    print("0")
  else:
    print("1")
x,y = map(int,input().split())
 
if abs(y) > abs(x):
  if x > 0 and y > 0:
    print(y-x)
  elif x < 0 and y <0:
    print(abs(y)-abs(x)+2)
  else:
    print(abs(y)-abs(x)+1)
elif abs(y) < abs(x):
  if x > 0 and y > 0:
    print(x - y + 2)
  elif x < 0 and y <0:
    print(abs(y-x))
  else:
    print(abs(abs(y)-abs(x))+1)
else:
  if x == y:
    print("0")
  else:
    print("1")

### FIXED CODE ###

x,y = map(int,input().split())
 
if abs(y) > abs(x):
  if x >= 0 and y >= 0:
    print(y-x)
  elif x < 0 and y <0:
    print(abs(y)-abs(x)+2)
  else:
    print(abs(y)-abs(x)+1)
elif abs(y) < abs(x):
  if x > 0 and y > 0:
    print(x - y + 2)
  elif x <= 0 and y <=0:
    print(abs(abs(y)-abs(x)))
  else:
    print(abs(abs(y)-abs(x))+1)
else:
  if x == y:
    print("0")
  else:
    print("1")
N, C = map(int, input().split())
timeTable = [tuple(map(int, input().split())) for i in range(N)]
sutyoku =  [[] for i in range(20003)]

for s,t,c in timeTable:
    if s == 0:
        for i in range(2*t):
            sutyoku[i].append(c)
    else:
        for i in range(2*s-1,2*t):
            sutyoku[i].append(c)

su_len = []
for s in sutyoku:
    su_len.append(len(set(s)))

print(max(su_len))


### FIXED CODE ###

import numpy

N, C = map(int, input().split())
STC = [list(map(int, input().split())) for i in range(N)]
Channel = numpy.array([[0]*(2*10**5+1) for i in range(C+1)])

for s, t, c in STC:
    Channel[c][2*s-1] += 1
    Channel[c][2*t] -= 1
    
for i in range(len(Channel)):
    Channel[i] = numpy.cumsum(Channel[i])
bool_Channel = Channel.astype(numpy.bool_)

needs = numpy.sum(bool_Channel, axis=0)
print(needs.max())
def main():
    N = int(input())
    B = [int(i) for i in input().split()]
    A = [0] * N
    A[0] = B[0]
    for i in range(1,N-1):
        A[i] = min(B[i-1],B[i])
    A[N-1] = B[N-1]
    print(sum(A))

if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    n = int(input())
    b = [int(i) for i in input().split()]

    a = ([b[0]])
    for i in range(1,n-1):
        a.append(min(b[i-1],b[i]))
    a.append(b[-1])
    print(sum(a))
if __name__ == "__main__":
    main()
6
AC
TLE
AC
AC
WA
TLE

### FIXED CODE ###

N = int(input())
status={'AC':0, 'WA':0, 'TLE':0, 'RE':0}
results = [input() for n in range(N)]
for result in results:
     if result in status.keys():
         status[result] += 1
for k, v in status.items():
    print('{} x {}'.format(k, v))
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
fact = math.factorial
sys.setrecursionlimit(10**9)
INF = 10**9
mod = 10**9+7

N,K = I()
ans = 0
f1 = fact(N-K+1)
f2 = fact(K-1)
for i in range(1,K+1):
    print((f1*f2//(fact(i)**2//i*fact(N-K-i+1)*fact(K-i)))%mod)

### FIXED CODE ###

import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
fact = math.factorial
sys.setrecursionlimit(10**9)
INF = 10**9
mod = 10**9+7

N,K = I()
ans = 0
f1 = fact(N-K+1)
f2 = fact(K-1)
for i in range(1,K+1):
    if N-K-i+1 < 0:
        print(0)
        continue
    print((f1*f2//(fact(i)**2//i*fact(N-K-i+1)*fact(K-i)))%mod)
# -*- coding: utf-8 -*-

import sys
from math import sqrt

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N=INT()

# for i in range(N, 0, -1):
#     print(i, N//i, N%i)

m=N
ans=set()
while m>=sqrt(N):
    i=N//m
    j=N%m
    if (i-j)%i==0 and N//m==N//(m-1):
        ans.add(m-1)
    m=N//(i+1)

for m in range(1, int(sqrt(N))+1):
    if N//m==N%m:
        ans.add(m)

print(sum(ans))


### FIXED CODE ###

# -*- coding: utf-8 -*-

import sys
from math import sqrt

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N=INT()

# for i in range(N, 0, -1):
#     print(i, N//i, N%i)

# 0除算対策
if N==1:
    print(0)
    exit()

m=N
ans=set()
while m>=sqrt(N):
    i=N//m
    j=N%m
    if (i-j)%i==0 and N//m==N//(m-1):
        ans.add(m-1)
    m=N//(i+1)

for m in range(1, int(sqrt(N))+1):
    if N//m==N%m:
        ans.add(m)

print(sum(ans))
s = input()
target = input()
for index in xrange(len(s)):
    ss = s[index]
    tt = target[index]
	
    if s[:index] != target[:index]:
        break
    if ss == tt:
        continue
    else: #ssとttを相互変換する
        s = s.replace(ss,"0").replace(tt,ss).replace("0",tt)

if s == target:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

from collections import Counter
s=sorted(Counter(input()).values())
t=sorted(Counter(input()).values())
print("Yes" if t==s else "No")
a, b, c = input().split()
abc = sorted([a, b, c])
ans = 'NO'
if abc[0] == '5' and abc[1] == '5' and = abc[2] == '7':
  ans = 'YES'
print(ans)

### FIXED CODE ###

a, b, c = input().split()
abc = sorted([a, b, c])
ans = 'NO'
if abc[0] == '5' and abc[1] == '5' and abc[2] == '7':
  ans = 'YES'
print(ans)
def solve(n,pos):
    global data,helper
    if(n==-1):
        return 0
    if(helper[n][pos]!=-1):
        return helper[n][pos]
    if(pos==0):
        helper[n][pos]=max(data[n][1]+solve(n-1,1),data[n][2]+solve(n-1,2))
        return helper[n][pos]
    elif(pos==1):
        helper[n][pos] = max(data[n][0]+solve(n-1,0),data[n][2]+solve(n-1,2))
        return helper[n][pos]
    else:
        helper[n][pos] = max(data[n][1]+solve(n-1,1),data[n][0]+solve(n-1,0))
        return helper[n][pos]
n=int(input())
data=[]
helper=[[-1 for y in range(3)] for x in range(n)]
for _ in range(n):
    temp=[int(x) for x in input().split()]
    data.append(temp)
t1=data[-1][0]+solve(n-2,0)
t2=data[-1][1]+solve(n-2,1)
t3=data[-1][2]+solve(n-2,2)
print(max(t1,t2,t3))

### FIXED CODE ###

n=int(input())
data=[]
t=[[0 for x in range(4)] for w in range(n+1)]
for _ in range(n):
    temp=[int(x) for x in input().split()]
    data.append(temp)
for i in range(1,n+1):
    for j in range(1,4):
        large=0
        for w in range(1,4):
            if(w==j):
                continue
            else:
                if(t[i-1][w]>large):
                    large=t[i-1][w]
        t[i][j]=data[i-1][j-1]+large
print(max(t[-1]))
n = int(input())
a = list(map(int, input().split()))

count = 0
flag = False

if a[0] >= a[1]:
  flag = True
else:
  flag = False
  
for i in range(1, n-1):
  if a[i] == a[i+1]:
    break
  elif a[i] > a[i+1]:
    if not flag:
      count+=1
      flag = False
  else:
    if flag:
      count+=1
      flag = True
print(count+1)



### FIXED CODE ###

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

flag = 0
 
ans = 1
for i in range(n - 1):
  if flag == 1:
    if a[i] > a[i + 1]:
      ans += 1
      flag = 0
  elif flag == -1:
    if a[i] < a[i + 1]:
      ans += 1
      flag = 0
  else:
    if a[i] > a[i + 1]:
      flag = -1
    elif a[i] < a[i + 1]:
      flag = 1
print(ans)
n, m = map(int, input().split())
s = list(input())
out = [set() for _ in range(n)]
count = [[0, 0] for _ in range(n)]
def f(c):
    if c == 'A': return 0
    else: return 1
for _ in range(m):
    a, b = map(int, input().split())
    if a == b:
        count[a-1][f(s[a-1])] += 1
    elif b-1 not in out[a-1]:
        count[a-1][f(s[b-1])] += 1
        count[b-1][f(s[a-1])] += 1
    out[a-1].add(b-1)
    out[b-1].add(a-1)
elim = set()
def eliminate(x):
    elim.add(x)
    c = f(s[x])
    for node in out[x]:
        if node not in elim:
            count[node][c] -= 1
            if count[node][0] * count[node][1] == 0:
                eliminate(node)
for i in range(n):
    if i not in elim and count[i][0] * count[i][1] == 0:
        eliminate(i)
if len(elim) < n: print('Yes')
else: print('No')

### FIXED CODE ###

n, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
ret = 0
for i in a:
    x -= i
    if x < 0:
        break
    ret += 1
if x > 0:
    ret -= 1
print(ret)
N = int(input())
A = list(map(int,input().split()))

if N == 1:
    if A[0] != 0:
        print(-1)
        exit()
    else:
        print(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)





### 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)
N,K = map(int,input().split())
P = [0 for i in range(N)]
for i in range(K):
  a = int(input())
  b = list(input().split())
  for j in range(a):
    P[b[j]-1] = 1 
m = 0   
for i in range(N):
  if P[i] == 0:
    m += 1

### FIXED CODE ###

n, k = map(int, input().split())
 
m = [0]*n
 
for i in range(k):
    d = int(input())
    a = [int(x) for x in input().split()]
    for j in range(d):
        m[a[j]-1] += 1
 
print(m.count(0))
import sys

data=sys.stdin.readline()
print(data^3)


### FIXED CODE ###

import sys

data=int(input())
print(data*data*data)
n,a,b = map(int,input().split())
box = ''
for i in range(n//(a+b)+1):
  box += ('b' * a)
  box += ('r' * b)
print(len([i for i in box[0:n] if i == 'b']))

### FIXED CODE ###

S = input()

if 'A' in S and 'B' in S:
  print('Yes')
else:
  print('No')
  
#ABA
#BBA
#BBB
a, b, c, d, e, k = map(int, input().split())
f = int(e-a)
if f > k:
    print(':(')
else:
    print('Yay!')

### FIXED CODE ###

a = [int(input()) for i in range(6)] 
f = a[4] - a[0]
if f > a[5]:
    print(':(')
else:
    print('Yay!')
N, M = map(int, input().splilt())
L = list(map(int, input().splilt()))
print(sum(sorted(L)[:M]))

### FIXED CODE ###

N, K = map(int, input().split())
p = list(map(int, input().split()))
print(sum(sorted(p)[:K]))
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n, a = LI()
x = LI()

dp = [[[0] * (250+1) for _ in range(n+1)] for _ in range(n+1)]
dp[0][0][0] = 1
for i in range(n+1):
    xi = x[i-1]
    for j in range(250+1):
        for k in range(i):
            dp[i][k][j] = dp[i-1][k][j]
    for j in range(xi, 250+1):
        for k in range(1, i+1):
            dp[i][k][j] += dp[i-1][k-1][j-xi]
ans = 0
for i in range(1, n+1):
    ans += dp[-1][i][i*a]
print(ans)

### FIXED CODE ###

#復習用
N, A = map(int, input().split())
X = list(map(lambda x: int(x) - A, input().split()))
maxn = max(max(X), A)
 
dp = [[0 for _ in range(2 * N * maxn + 1)] for _ in range(N + 1)]
dp[0][N * maxn] = 1
for i in range(N):
    for k in range(2 * N * maxn + 1):
        dp[i + 1][k] = dp[i][k]
        if 0 <= k - X[i] < 2 * N * maxn:
            dp[i + 1][k] += dp[i][k - X[i]] 
print(dp[N][N * maxn] - 1)
import math
import copy
import sys
import fractions
import numpy as np
from functools import reduce
import statistics


# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

def gettwice(n):
    counter = 0
    flg = True
    while(flg):
        if n % 2 == 1:
           flg = False
        else:
            n = n/2
            counter+=1

    return counter

n = getInputInt()
data = getInputListInt()

ans = 0
tmpans = 0

oddData = []
evenData = []

for i in range(len(data)):
    if data[i] % 2 == 0:
        evenData.append(data[i])
    else:
        oddData.append((data[i]))

maxOddNum = max(oddData)

for i in range(len(evenData)):
        tmpans += gettwice(evenData[i])

print(tmpans)

### FIXED CODE ###

import math
import copy
import sys
import fractions
import numpy as np
from functools import reduce
import statistics


# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

def gettwice(n):
    counter = 0
    flg = True
    while (flg):
        if n % 2 == 1:
            flg = False
        else:
            n = n / 2
            counter += 1

    return counter


k = getInputInt()
data = getInputListInt()

ans = 0

for i in range(len(data)):
    ans += gettwice(data[i])

print(ans)
import sys
import math
 
a,b=map(int, input().split())
 
probablity = 0.0
 
for i in range(a + 1):
  ceil = math.ceil(math.log2(b / (i + 1)))
  if(ceil < 0):
    ceil = 0
  elif(ceil < 1):
    ceil = 1
    
  probablity = probablity + 1 / (a * 2 ** ceil)
  
print(probablity)
import sys
import math
 
a,b=map(int, input().split())
 
probablity = 0.0
 
for i in range(a + 1):
  ceil = math.ceil(math.log2(b / (i + 1)))
  if(ceil < 0):
    ceil = 0
  elif(ceil < 1):
    ceil = 1
    
  probablity = probablity + 1 / (a * 2 ** ceil)
  
print(probablity)
import sys
import math
 
a,b=map(int, input().split())
 
probablity = 0.0
 
for i in range(a + 1):
  ceil = math.ceil(math.log2(b / (i + 1)))
  if(ceil < 0):
    ceil = 0
  elif(ceil < 1):
    ceil = 1
    
  probablity = probablity + 1 / (a * 2 ** ceil)
  
print(probablity)
import sys
import math
 
a,b=map(int, input().split())
 
probablity = 0.0
 
for i in range(a + 1):
  ceil = math.ceil(math.log2(b / (i + 1)))
  if(ceil < 0):
    ceil = 0
    
  probablity = probablity + 1 / (a * 2 ** ceil)
  
print(probablity)

### FIXED CODE ###

import sys
import math
 
a,b=map(int, input().split())
 
probablity = 0.0
 
for i in range(a):
  ceil = math.ceil(math.log2(b / (i + 1)))
  if(ceil < 0):
    ceil = 0
    
  probablity = probablity + 1 / (a * 2 ** ceil)
  
print(probablity)
n, m, c = map(int, input().split())
b = list(map(int, input().split()))
ans = 0
for i in range(N):
  a = list(map(int, input().split()))
  point = c
  for i in range(m):
    point += a[i]*b[i]
  if point > 0:
    ans += 1
print(ans)

### FIXED CODE ###

n, m, c = map(int, input().split())
b = list(map(int, input().split()))
ans = 0
for i in range(n):
  a = list(map(int, input().split()))
  point = c
  for i in range(m):
    point += a[i]*b[i]
  if point > 0:
    ans += 1
print(ans)