Problem:


Score: 300 points

Problem Statement

As AtCoder Beginner Contest 100 is taking place, the office of AtCoder, Inc. is decorated with a sequence of length N, a = {a_1, a_2, a_3, ..., a_N}.

Snuke, an employee, would like to play with this sequence.

Specifically, he would like to repeat the following operation as many times as possible:

For every i satisfying 1 \leq i \leq N, perform one of the following: "divide a_i by 2" and "multiply a_i by 3".  
Here, choosing "multiply a_i by 3" for every i is not allowed, and the value of a_i after the operation must be an integer.

At most how many operations can be performed?

Constraints

N is an integer between 1 and 10 \ 000 (inclusive).

a_i is an integer between 1 and 1 \ 000 \ 000 \ 000 (inclusive).

Input

Input is given from Standard Input in the following format:

N
a_1 a_2 a_3 ... a_N

Output

Print the maximum number of operations that Snuke can perform.

Sample Input 1

3
5 2 4

Sample Output 1

3

The sequence is initially {5, 2, 4}. Three operations can be performed as follows:

First, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {15, 6, 2}.

Next, multiply a_1 by 3, divide a_2 by 2 and multiply a_3 by 3. The sequence is now {45, 3, 6}.

Finally, multiply a_1 by 3, multiply a_2 by 3 and divide a_3 by 2. The sequence is now {135, 9, 3}.

Sample Input 2

4
631 577 243 199

Sample Output 2

0

No operation can be performed since all the elements are odd. Thus, the answer is 0.

Sample Input 3

10
2184 2126 1721 1800 1024 2528 3360 1945 1280 1776

Sample Output 3

39



Sample input:
3
5 2 4


Sample output:
3

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
ans = 0
for i in a:
  while i % 2 ==0:
    i /= 2
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int,input().split()))

def divide(a):
    count=0
    while a%2 == 0: 
        a=a//2
        count+=1
    else:
        return count

Ans=0
for i in A:
    Ans+=divide(i)
print(Ans)

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
cnt=0
for i in a:
    while i%2==0:
        cnt+=1
        i/=2
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
A = list(map(int, input().split()))
c = 0
for i in A:
  while i%2 == 0:
    i //= 2
    c += 1
print(c)

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int,input().split()))


ans=0
for i in range(N):
    while A[i]%2==0:
        ans+=1
        A[i]//=2
print(ans)

Submission status: Accepted

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

def f(x):
    cnt = 0
    while True:
        if x%2:
            return cnt
        else:
            x //= 2
            cnt += 1
n = inp()
a = inpl()
res = 0
for i in a:
    res += f(i)
print(res)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys, math
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans=count=0

def div2(n):
    count=0
    while n%2==0:
        n=n//2
        count+=1
    return count
        

n=int(input())
a=list(map(int,input().split()))
for ai in a:
    count+=div2(ai)
print(count)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
#print(a)

#２で何回割り切れるか？
cnt = 0
for num in a:
  while num%2 == 0:
    num /= 2
    cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
A = [int(x) for x in input().split()]
ans = 0
for a in A:
    while a % 2 == 0:
        ans += 1
        a /= 2
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
ans=0
cnt=0
a=list(map(int,input().split()))
for i in range(n):
    for j in range(100):
        if a[i]%2==0:
            a[i]=a[i]//2
            cnt+=1
        else:
            ans+=cnt
            cnt=0
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int,input().rstrip().split()))

ans = 0
i = 0
while i < N:
    if a[i]%2 == 0:
        ans += 1
        a[i] /= 2
        i -= 1
    i += 1

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int,input().split()))
tmp = []
for i in range(N):
    if a[i]%2 == 0:
        tmp.append(a[i])
if tmp == []:
    print(0)
else:
    ans = 0
    for i in range(len(tmp)):
        num = tmp[i]
        count = 0
        while num%2 == 0:
            num = num/2
            count += 1
        ans += count
    print(ans)

Submission status: Accepted

Solution code:
N = int(input())
d = {}

def f(x):
  if x in d:
    return d[x]
  if x % 2 == 0:
    d[x] = 1 + f(x / 2)
    return d[x]
  else:
    d[x] = 0
    return d[x]

A = list(map(lambda x: f(x), [int(x) for x in input().split()]))
print(sum(A))

Submission status: Accepted

Solution code:
n=int(input())
A=list(map(int,input().split()))
r=0
for i in range(n):
   while A[i]%2==0:
       A[i]//=2
       r+=1
print(r)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))

ans = 0
while True:
    count = 0
    for i in range(N):
        if a[i] % 2 == 0:
            ans += 1
            a[i] //= 2
        else:
            count += 1
    if count == N:
        break
        
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
A = list(map(int, input().split()))

count = 0

for a in A:
  
  while a%2 == 0:
    a //= 2
    count += 1

print(count)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
i = 0
sousa = 0
while i <= n-1:
  j = 0
  while j == 0:
    if a[i]%2 == 0:
      a[i] = a[i]/2
      sousa += 1
      j = 0
    else:
      j = 1
  i += 1
print(sousa)

Submission status: Accepted

Solution code:
n = int(input())
a_list = list(map(int, input().split()))
def count_2(num):
    count = 0
    while num%2 == 0:
        num /= 2
        count += 1
    return count
ans = 0
for i in range(n):
    ans += count_2(a_list[i])
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
mod = 10**9+7

def f(num):
    global count
    while num%2==0:
        num=num//2
        count+=1


n=int(input())
A=list(map(int,input().split()))
count=0
for a in A:
    f(a)
print(count)

Submission status: Accepted

Solution code:
n=int(input())
a=[int(x) for x in input().split()]

c=0
for i in range(n):
  while a[i]%2==0:
    a[i] /= 2
    c += 1

print(c)

Submission status: Accepted

Solution code:
def d2(n):
    cnt=0
    while n%2==0:
        n=n//2
        cnt+=1
    return cnt

n=int(input())
A=list(map(int,input().split()))
ans=0
for i in range(n):
    ans += d2(A[i])
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
cnt = 0
for a in A:
    while True:
        if a % 2 == 0:
            a /= 2
            cnt += 1
        else:
            break
print(cnt)

Submission status: Accepted

Solution code:
#                         author:  kagemeka 
#                         created: 2019-11-08 12:38:16(JST)
## internal modules
import sys
# import collections
import math
# import string
# import bisect
# import re
# import itertools
# import statistics
# import functools
# import operator
## external modules
# import scipy.special   # if use comb function on AtCoder, 
# import scipy.misc      # select scipy.misc.comb (old version) 

def main():
    n, *a = (int(x) for x in sys.stdin.read().split())

    total_count = 0
    atmost = math.floor(math.log(10 ** 9, 2))
    for i in range(n):
        current = a[i]
        count = 0
        for _ in range(atmost + 1):
            if current % 2 == 0:
                current //= 2
                count += 1
            else:
                break
        total_count += count
    
    print(total_count)

if __name__ == "__main__":
    # execute only if run as a script
    main()

Submission status: Accepted

Solution code:
#                         author:  kagemeka 
#                         created: 2019-11-08 12:38:16(JST)
## internal modules
import sys
# import collections
import math
# import string
# import bisect
# import re
# import itertools
# import statistics
# import functools
# import operator
## external modules
# import scipy.special   # if use comb function on AtCoder, 
# import scipy.misc      # select scipy.misc.comb (old version) 

def main():
    n, *a = (int(x) for x in sys.stdin.read().split())

    total_count = 0
    for i in range(n):
        current = a[i]
        count = 0
        for _ in range(math.floor(math.log(10 ** 9, 2)) + 1):
            if current % 2 == 0:
                current //= 2
                count += 1
            else:
                break
        total_count += count
    
    print(total_count)

if __name__ == "__main__":
    # execute only if run as a script
    main()

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))

con = 0

for i in range(0,N):
  while A[i] % 2 == 0:
    A[i] = A[i] // 2
    con += 1

print(con)

Submission status: Accepted

Solution code:
import math
point=0
N=int(input())
L=list(map(int,input().split()))
for j in L:
  s=0
  while j%2==0:
    s+=1
    j//=2
  point+=s
print(point)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(N):
  while a[i]%2==0:
    ans += 1
    a[i] /= 2
print(ans)

Submission status: Accepted

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

ans = 0
for i in a:
    while i % 2 == 0:
        ans += 1
        i //= 2
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import math

def main():
    N = int(input())
    a_list = [int(s) for s in input().split()]
    sousa_count = 0
    for a in a_list:
        sousa_count += count_devide_2(a)
    print(sousa_count)

def count_devide_2(num):
    count = 0
    while True:
        if num%2 == 0:
            num = math.floor(num/2)
            count += 1
        else:
            return count

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
cnt = 0
for i in range(len(a)):
    while a[i] % 2 == 0:
        a[i] = a[i] // 2
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
ans = 0
for a in A:
    while a%2 == 0:
        a = a//2
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
from collections import deque

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

cnt = 0
while len(a)>0:
    x = a.pop()
    if x%2 == 0:
        a.append(x//2)
        cnt += 1
print(cnt)

Submission status: Accepted

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

cnt = 0
while len(a)>0:
    x = a.pop()
    if x%2 == 0:
        a.append(x//2)
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int,input().split()))
n=0
for a in A:
  while a%2==0:
    n+=1
    a/=2
print(n)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(lambda x: int(x), input().split(' ')))

ans = 0
for a in A:
    while a % 2 == 0:
        a /= 2
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
ain2 = [0]*N
for i in range(N):
    k = a[i]
    count = 0
    while(k % 2 == 0):
        k = k / 2
        count += 1
    ain2[i] = count
print(sum(ain2))

Submission status: Accepted

Solution code:
n=int(input())
l=list(map(int,input().split()))
count=0
for i in range(n):
  num=l[i]
  while num%2==0:
    count+=1
    num=num//2
print(count)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
s = 0
for n in range(N):
  a = A[n]
  while a%2 == 0:
    a = a//2
    s = s+1
print(s)

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int,input().split()))
count=0
for i in A:
    while i%2==0:
        i=round(i/2)
        count+=1
print(count)

Submission status: Accepted

Solution code:
N=int(input())
A=[int(x) for x in input().split()]
B=[]
for i in range(N):
    B +=[bin(A[i])[::-1].find('1')]
print(sum(B))

Submission status: Accepted

Solution code:
def f(n):
  c = 0
  while n % 2 == 0:
    c += 1
    n = n // 2
  return c
 
n = int(input())
a = list(map(int, input().split()))
print(sum((f(ai) for ai in a if ai % 2 == 0)))

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
total = 0
for i in range(n):
    while a[i]%2==0:
        a[i] = a[i]//2
        total += 1
    else:
        continue
print(total)

Submission status: Accepted

Solution code:
n=int(input())
l=[int(i) for i in input().split()]
cnt=0 
for i in l:
    while i:
        if i%2:
            break 
        cnt+=1 
        i>>=1 
print(cnt)

Submission status: Accepted

Solution code:
import math

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

count=0
for a in a_list:
    tmp=a
    while (tmp%2==0):
        count+=1
        tmp=tmp//2

print(count)

Submission status: Accepted

Solution code:
def input():
    import sys
    return sys.stdin.readline().rstrip()


def main():
    import math
    import collections
    import itertools

    n = int(input())
    as_ = list(map(int, input().split()))
    num_div = 0
    for a in as_:
        i = 0
        while True:
            if a & (1 << i) == 0:
                num_div += 1
                i += 1
            else:
                break
    print(num_div)




if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
count=0
for i in range(n):
    num=a[i]
    while num%2==0:
        num//=2
        count+=1
print(count)

Submission status: Accepted

Solution code:
n = int(input())
a = [int(x) for x in input().split()]
ans = 0
for i in a:
    while i % 2 == 0:
        ans += 1
        i /= 2
print(ans)

Submission status: Accepted

Solution code:
def cnt(n):
    res = 0
    while True:
        n = n / 2
        if n.is_integer():
            res += 1
        else:
            return res


ans = 0
_ = input()
for a_str in input().split():
    a = int(a_str)
    if a % 2 == 0:
        ans += cnt(a)

print(int(ans))

Submission status: Accepted

Solution code:
N=int(input())
a=list(map(int,input().split()))

ans=0
for i in range(N):
  data=a[i]
  while data%2==0:
    data=data//2
    ans+=1
    
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
As = list(map(int, input().split()))

powers = [0] * N
for i, A in enumerate(As):
    cnt = 0
    while A % 2 == 0:
        A /= 2
        cnt += 1
    powers[i] = cnt
print(sum(powers))

Submission status: Accepted

Solution code:
n = int(input())
a = [int(i) for i in input().split()]
count = 0
ji = True
for i in range(n):
    while a[i]%2==0:
        a[i] = a[i]//2
        count+=1
print(count)

Submission status: Accepted

Solution code:
# WIP
import sys
sys_input = sys.stdin.readline
N = int(sys_input())
aaa = list(map(int, sys_input().split()))

# If all values are odd
aaa_remain = set(map(lambda x: x % 2, aaa))
if len(aaa_remain) == 1 and sum(aaa_remain) == 1:
    print(0)
    exit()

aaa_even = [a for a in aaa if a % 2 == 0]

n_divide = 0
is_dividable = True
for a in aaa_even:
    target_a = a
    while is_dividable:
        is_dividable = False if target_a % 2 else True
        if is_dividable:
            target_a = target_a//2
            n_divide += 1
    is_dividable = True

print(n_divide)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(n):
    while a[i] % 2 == 0:
        a[i] = a[i] // 2
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
import sys

if __name__ == '__main__':
	input()
	A = list(map(int,sys.stdin.readline().split()))

	cnt = 0
	EVE = [i for i in A if i % 2 == 0]

	for j in EVE:
		while True:
			j = j // 2
			if j % 2 == 1:
				cnt += 1
				break
			cnt += 1

	print(cnt)

Submission status: Accepted

Solution code:
n = int(input())

lis = list(map(int, input().split()))

ans = 0
for i in range(n):
  while lis[i]%2 == 0:
    lis[i] //= 2
    ans+=1

print(ans)

Submission status: Accepted

Solution code:
def log(n):
    res=0
    while n%2==0:
        res+=1
        n//=2
    return res

N=int(input())
a=list(map(int,input().split()))
ans=sum([log(ai) for ai in a])
print(ans)

Submission status: Accepted

Solution code:
input()
A = list(filter(lambda x: x % 2 == 0, map(int, input().split())))
count = 0
for i in A:
    tmp = i
    while True:
        if tmp % 2 == 0:
            count += 1
            tmp = int(tmp/2)
        else:
            break
print(count)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
ans = 0

for i in range(n):
    if a[i] % 2 == 1:
        continue

    temp = a[i]
    while temp > 0 and temp % 2 == 0:
        #print('temp: ' + str(temp))
        temp /= 2
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int,input().split()))
B=[0]*N

def nanji(a,b):
    t = a
    count = 0
    while t % b == 0:
        t = t / b
        count = count +1
    return(count)

for i in range(N):
    B[i] = nanji(A[i],2)

print(sum(B))

Submission status: Accepted

Solution code:
n = int(input())
A = list(map(int, input().split()))

ans = 0
for a in A:
    for i in range(31):
        if a % (2**i) != 0:
            ans += i-1
            break

print(ans)

Submission status: Accepted

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

ans = 0

for i in a:
    if i%2 ==0:
        while i%2 == 0:
            ans += 1
            i /= 2

print(ans)

Submission status: Accepted

Solution code:
n = input()
A = list(map(int, input().split()))

cnt = 0
for a in A:
    while a % 2 == 0:
        a //= 2
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
N=int(input())
l=list(map(int,input().split()))
l2=[n for n in l if n%2 ==0]
ans=0
for i in l2:
  while(i%2==0):
    ans+=1
    i /= 2
print(ans)

Submission status: Accepted

Solution code:
import math
n = int(input())
a = list(map(int,input().split()))
maxlog = int(math.log2(max(a)))
answer = 0
for _ in range(maxlog):
  a = [aa/2 for aa in a if aa%2==0]
  answer+= len(a)
  if not a:
    break
print(answer)

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np

N = int(readline())
A = np.array(read().split(),np.int32)

answer = 0
for _ in range(32):
    A = A[A%2 == 0]
    answer += len(A)
    A >>= 1

print(answer)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
ans = 0
for i in range(N):
    while A[i] % 2 == 0:
        ans += 1 
        A[i] /= 2
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
a = list(map(int,input().split()))
cnt=0
for i in range(n):
    while a[i]%2==0:
        a[i]=a[i]//2
        cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
ary = list(map(int,input().split()))
ans = 0
for i in range(len(ary)):
    a = ary[i]
    if a % 2 == 0:
        while a % 2 == 0:
            ans += 1
            a = a // 2
print(ans)

Submission status: Accepted

Solution code:
a = int(input())
lista = list(map(int, input().split()))
ans=0

for i in lista:
  while i % 2==0:
    i = i / 2
    ans += 1
    
print(ans)

Submission status: Accepted

Solution code:
def meu_map(l):
    for i in range(len(l)):
        l[i] = int(l[i])


n = int(raw_input())
array = raw_input().split()

meu_map(array)

fatores = 0
for e in array:
    while e != 1:
        if e % 2 == 0:
            e /= 2
            fatores += 1
        else:
            break

print(fatores)

Submission status: Accepted

Solution code:
n = int(input())
a = [ int(x) for x in input().split() ]
 
tot = 0
 
for i in a:
    x = i
    while x % 2 == 0:
        x /= 2
        tot += 1
 
print(tot)

Submission status: Accepted

Solution code:
n = int(input())
a = map(int, input().split())

count = 0 
for ai in a:
  x = ai
  while (x % 2 == 0):
    x /= 2
    count += 1
 
print(count)

Submission status: Accepted

Solution code:
n1 = int(input())

lista = list(map(int, input().split()))

cont = 0
for e in lista:
    aux = e
    while(aux%2 == 0):
        aux /= 2
        cont += 1
        

print(cont)

Submission status: Accepted

Solution code:
n = int(raw_input())
input_list = map(int, raw_input().split())

total = 0

for num in input_list:
    partial = 0
    while (num % 2 == 0):
        partial += 1
        num /= 2
    total += partial

print(total)

Submission status: Accepted

Solution code:
n = int(input())
a = map(int, input().split())
 
cont = 0
 
for e in a:
    x = e
    while x % 2 == 0:
        x /= 2
        cont += 1
 
print(cont)

Submission status: Accepted

Solution code:

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

cnt = 0

for ai in A:
    x = ai
    while x % 2 == 0:
        x /= 2
        cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
for i in map(int,input().split()):
    a = i
    while a % 2 == 0:
        ans += 1
        a = a // 2
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int,input().split()))
ans = 0
for i in range (0,N):
  s = 0
  while a[i] % 2 == 0:
    s = s + 1
    a[i] = a[i] / 2
  ans = ans + s
print(ans)

Submission status: Accepted

Solution code:


def resolve():
    N=int(input())
    count=0
    for i in input().split():
        x=int(i)

        while x%2==0:
            count+=1
            x /=2
    print(count)



if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
a=int(input())
lis=list(map(int, input().split()))
ans=0
for i in lis:
  while i%2==0:
    i=i/2
    ans+=1
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
count=0
for i in range(n):
    while a[i]%2==0:
        count+=1
        a[i]/=2
print(count)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
count = 0
for i in range(n):
    while a[i] % 2 == 0:
        a[i] = a[i] // 2
        count += 1
print(count)

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
count=0
for i in range(n):
  if a[i]%2==0:
    j=1
    while True:
      if a[i]%(2**j)==0:
        j+=1
      else:
        count+=j-1
        break
print(count)

Submission status: Accepted

Solution code:
N = input()
A = map(int, input().split())
cnt = 0
for i in A:
    while(True):
        if i % 2 == 0:
            cnt += 1
            i = i // 2
        else:
            break
print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))

# 操作回数が最も多くなるのは、数列のうち1つだけを2で割る操作を繰り返すとき
# 数列全体に含まれる因数2の個数が解

def n_factor2(x):
    i = 0
    while x%2 == 0:
        x /= 2
        i += 1
    return i

ans = 0
for x in a:
    ans += n_factor2(x)

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
cnt =0
for x in a:
    for i in range(1,30):
        if x %2**i ==0:
            cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
ans = 0
cnt = 0
while 1:
    for i in range(N):
        if a[i] % 2 == 0:
            ans += 1
            a[i] //= 2
        else:
            cnt += 1
    if cnt == N:
        break
    else:
        cnt = 0
print(ans)

Submission status: Accepted

Solution code:
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    a = list(map(int, input().rstrip('\n').split()))
    cnt = 0
    for i in range(n):
        t = a[i]
        while True:
            if t % 2 == 0:
                cnt += 1
                t //= 2
            else:
                break
    print(cnt)


if __name__ == '__main__':
    slove()

Submission status: Accepted

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

x=[]
for i in range(n):
  b=0
  while a[i]%2==0:
    a[i]/=2
    b+=1
  x.append(b)
print(sum(x))

Submission status: Accepted

Solution code:
from collections import deque

n = int(input())
A = list(map(int,input().split()))
s = deque(A)

ans = 0

while s :
    a = s.popleft()
    if a%2==0:
        s.append(a//2)
        ans +=1
print(ans)

Submission status: Accepted

Solution code:
def test():
    n = int(input())
    a = list(map(int,input().split()))
    ans = 0
    for i in a:
        if i % 2 == 0:
            while i%2 == 0:
                i /= 2
                ans += 1
    print(ans)


if __name__ == "__main__":
    test()

Submission status: Accepted

Solution code:
def a(n):
    i=0
    while n%2==0:
        i+=1
        n//=2
    return i
n=int(input())
print(sum([a(int(i)) for i in input().split()]))

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
ans=0
while True:
    cnt=0
    for i in range(n):
        if a[i]%2==0:
            a[i]//=2
            ans+=1
            cnt+=1
    if cnt==0: break
print(ans)

Submission status: Accepted

Solution code:
N = input()
a = list(map(int, input().split()))

c = 0

for i, aa in enumerate(a):
    while a[i] % 2 == 0:
        a[i] /= 2
        c += 1

print(c)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
Ans = [1]
for i in A:
    if i%2 == 0:
        Ans.append(i)
cnt = 0
for j in Ans:
    while j%2 == 0:
        cnt += 1
        j = j//2
print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
a = [int(i) for i in input().split()]

ret = 0
for a_ in a :
    while a_ % 2 == 0 :
        a_ //= 2
        ret += 1
        
print(ret)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
res = 0

for sa in a:
    while sa % 2 ==0:
        sa //= 2
        res += 1

print(res)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))

ans = 0
for i in range(N):
  x = A[i]
  while x % 2 == 0:
    x = x//2
    ans += 1
    #print(x,ans)
    
print(ans)

Submission status: Accepted

Solution code:
def fact2( n ):
    ans = 0
    while n > 0:
        if n % 2 == 0:
            n = n // 2
            ans += 1
        else:
            break
    return ans

N = int(input())
Data = list(map(int,input().split()))
ans = 0
for d in Data:
    ans += fact2(d)
print(ans)

Submission status: Accepted

Solution code:
import math

def wareru(s):

    buff = s
    c = 0
    while True:
        if buff % 2 == 0:
            c+=1
            buff = buff / 2
        else:
            return c

N = int(input())
A = list(map(int, input().split()))

ans = 0
for i in range(N):
    ans += wareru(A[i])
    # if A[i] == 2:
    #     ans += 1

    # for el in buff:
    #     if el == 2:
    #         ans += 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
count = 0
for i in range(n):
  if a[i]%2 != 0:
    continue
  elif a[i]%2 == 0:
    while True:
      if a[i]%2 != 0:
        break
      else:
        a[i] //= 2
        count += 1
print(count)

Submission status: Accepted

Solution code:
import sys


def input(): return sys.stdin.readline().strip()


def solve(N, a):
    def f(x): return 0 if x % 2 != 0 else 1+f(x//2)
    ans = sum(map(f, a))
    return ans


def main():
    N = int(input())
    a = list(map(int, input().split()))
    ans = solve(N, a)
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())
A = map(int, input().split())
count = 0
for a in A:
    while a%2 == 0:
        count += 1
        a //= 2
print(count)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))

cnt = 0

for i in range(N):
    while True:
        if a[i] % 2 == 0:
            a[i] //= 2
            cnt += 1
        else:
            break
print(cnt)

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int,input().split()))

def factorization(n):
    arr = []
    temp = n
    i=2
    if temp%i==0:
        cnt=0
        while temp%i==0:
            cnt+=1
            temp //= i
        arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

cnt=0
for a in A:
    f=factorization(a)[0]
    if f[0]==2:
        cnt+=f[1]

print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
cnt = 0
for i in range(N):
    a = A[i]
    while 1:
        if a%2==0:
            cnt += 1
            a = a//2
        else:break
print(cnt)

Submission status: Accepted

Solution code:
def div2(n):
  i=n
  a=0
  while True:
    if i%2!=0:
      return a
    i//=2
    a+=1

n=int(input())
a=list(map(int,input().split()))
ans=0
for i in a:
  ans+=div2(i)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
array = list(map(int, input().split()))
cnt = 0
for i in range(N):
    while True:
        if array[i] % 2 != 0:
            break
        array[i] /= 2
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
n=int(input())
x=list(map(int,input().split()))
cnt=0
for i in range(n):
    cnt+=format(x[i], 'b')[::-1].find('1')
print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
A = [int(x) for x in input().split()]
ans = 0
for i in A:
  while i%2==0:
    i=i//2
    ans+=1
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int, input().split()))
count=0
for i in range(n):
    while(a[i]%2==0):
        a[i]/=2
        count+=1
print(count)

Submission status: Accepted

Solution code:
def q77(N, a):
    i = 0
    for b in a:
        while True:
            b = b/2
            if not b.is_integer():
                break
            else:
                i += 1
    return i

N = int(input())
a = [int(i) for i in input().split()]

print(q77(N, a))

Submission status: Accepted

Solution code:
import math
def q77(N, a):
    i = 0
    o = 0
    while True:
        b = False
        for j in range(o, N):
            a[j] = a[j]/2
            if a[j].is_integer():
                i += 1
                b = True
                break
            else:
                o = j
        if not b:
            break
    return i

N = int(input())
a = [int(i) for i in input().split()]

print(q77(N, a))

Submission status: Accepted

Solution code:
N=int(input())
a=[int(i) for i in input().split()]

ans=0
for i in range(N):
    for j in range(1,10000):
        if a[i]%(2**j)==0:
            ans+=1
        else:
            break

print(ans)

Submission status: Accepted

Solution code:
def count2(x):
    count = 0
    while x % 2 == 0:
        x //= 2
        count += 1
    return count

N = int(input())
A = list(map(int, input().split()))

print(sum(count2(a) for a in A))