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: Time Limit Exceeded

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


count = 0



while(True):
    even_count = 0
    even_index = 0
    for i in range(len(a)):
        if a[i] % 2 == 0:
            even_index = i
            even_count += 1

    if even_count >= 1:
        count += 1
        a[even_index] = int(a[even_index] / 2)
    else:
        break

print(count)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

r = 0
i = 1
while True:
  f = False
  for a in aas:
    if a%2 == 0:
      a /= 2
      r += 1
      f = True
  if not f:
    break
print(r)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
input()
n = [int(i) for i in input().split()]
index = 0
count = 0
while any([i % 2 == 0 for i in n]):
    if n[index] % 2 == 0:
        n[index] /= 2
        n[index] = int(n[index])
        count += 1
    else:
        index += 1

print(count)

Submission status: Time Limit Exceeded

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

warizan = 0
count = 0
while(1):
    warizan = 0
    for index,i in enumerate(a):
        if int(i)/2>0 and int(i) % 2 == 0 and warizan==0:
            a[index] = int(int(i)/2)
            warizan+=1
    if warizan == 0:
        break
    count = count+1
print(count)

Submission status: Time Limit Exceeded

Solution code:
import sys

sys.stdin.readline()
a = list(map(int, sys.stdin.readline().split()))

a = [x for x in a if x % 2 == 0]

cnt = 0
while a:
    a.sort(reverse=True)
    if a[0] % 2 == 0:
        a[0] //= 2
        if a[0] % 2 != 0:
            del a[0]
        cnt += 1
    else:
        break

print(cnt)

Submission status: Time Limit Exceeded

Solution code:
import sys

sys.stdin.readline()
a = list(map(int, sys.stdin.readline().split()))

a = [x for x in a if x % 2 == 0]

cnt = 0
while True:
    a.sort(reverse=True)
    flag = True
    for i, v in enumerate(a):
        if flag and v % 2 == 0:
            a[i] //= 2
            flag = False
        else:
            a[i] *= 3
    if flag:
        break
    cnt += 1
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python

MAX = 1000000000

n = int(input().rstrip())
a = [int(temp) for temp in input().rstrip().split(" ")]

count = 0

while True:

    a.sort()
    a.reverse()

    is_success = True

    div_flag = False
    for i in range(n):
        if div_flag == False and a[i] % 2 == 0:
            a[i] = int(a[i] / 2)
            div_flag = True
        else:
            a[i] = int(a[i] * 3)

        # (MAX < a[i] * 3 and a[i] % 2 != 0)
        if div_flag == False and i == n-1:
            is_success = False

    if is_success:
        count += 1
    else:
        break


print(count)

Submission status: Time Limit Exceeded

Solution code:
i = int(input())
ii = input().split()

a = int(0)
n = int(0)
m = int(0)
k = int(0)
for n in ii:
    a = int(n)
    for m in range(i):
      while (a % 1 == 0):
        a = a/2
        if (a % 1 == 0):
            k += 1

print(k)

Submission status: Time Limit Exceeded

Solution code:
def get_input():
    while True:
        try:
            yield ''.join(raw_input())
        except EOFError:
            break

if __name__ == '__main__':
    k = list(get_input())
    m = k[1]
    l = m.split()
    
    a = 1

    for i in range(len(l)):
        a = a*int(l[i]) 
    res = a
    itr = 0;
    
    while res%2 == 0:
        res = res/2
        itr = itr +1

    print itr

Submission status: Time Limit Exceeded

Solution code:
N = input()
number = input()

a = number.split()
n_list=[]
count=0



for num in a:
    num = int(num)
    if num % 2 == 0:
        n_list.append(num)

if n_list != []:
    maxnum = max(n_list)
    for num2 in n_list:
        for i in range(maxnum):
            if num2 % 2**(i+1) == 0:
                count+=1


print(count)

Submission status: Time Limit Exceeded

Solution code:
import numpy
n=int(input())
l=numpy.array(list(map(int, input().split())))
a=l.prod()
c=0
while a%2==0:
    a//=2
    c+=1
print(c)

Submission status: Time Limit Exceeded

Solution code:
from collections import deque

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

C = 0
while True:
    if len([n for n in A if n > 0 and n % 2 == 0]) == 0:
        break
    # 最大の偶数を探す
    max_even = max([n for n in A if n % 2 == 0])
    max_even_index = A.index(max_even)
    B = []
    for i, n in enumerate(A):
        if i == max_even_index:
            B.append(n // 2)
        else:
            B.append(n * 3)
    C += 1
    A = B
print(C)

Submission status: Time Limit Exceeded

Solution code:
import sys

sys.stdin.readline()
a = list(map(int, sys.stdin.readline().split()))

cnt = 0
while True:
    a.sort(reverse=True)
    flag = True
    for i, v in enumerate(a):
        if flag and v % 2 == 0:
            a[i] //= 2
            flag = False
        else:
            a[i] *= 3
    if flag:
        break
    cnt += 1
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
def judge():
    four = []
    even = []
    odd = []
    for a in a_list:
        if a % 2 == 1:
            odd.append(a * 3)
        else:
            if a % 4 == 0:
                four.append(a)
            else:
                even.append(a)
    if len(four) > 0:
        odd.append(four.pop() // 2)
        four = [i * 3 for i in four]
        odd.extend(four)
        even = [i * 3 for i in even]
        odd.extend(even)
    else:
        if even:
            odd.append(even.pop() // 2)
            even = [i * 3 for i in even]
            odd.extend(even)
        else:
            return False
    global a_list
    a_list = odd
    return True


N = int(input())
a_list = list(map(int, input().split()))
cnt = 0
while True:
    if judge():
        cnt += 1
    else:
        break
print(cnt)

Submission status: Time Limit Exceeded

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

warizan = 0
count = 0
while(1):
    warizan = 0
    for index,i in enumerate(a):
        if int(i)/2>0 and int(i) % 2 == 0 and warizan==0:
            a[index] = int(int(i)/2)
            warizan+=1
        elif int(i)*3 <= 1000000000:
            a[index] = int(i)*3
    if warizan == 0:
        break
    count = count+1
print(count)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
N=int(input())
a=list(map(int, input().split(' ')))
a=int(np.prod(a))
count=0
while a%2==0:
    count+=1
    a=a/2
print(count)

Submission status: Time Limit Exceeded

Solution code:
import sys

sys.stdin.readline()
a = list(map(int, sys.stdin.readline().split()))

def largest_odd_idx(A):
    idx = -1
    max_a = 0
    for i, v in enumerate(A):
        if v % 2 == 0 and max_a < v:
            max_a = v
            idx = i
    return idx

cnt = 0
while True:
    idx = largest_odd_idx(a)
    if idx < 0:
        break
    for i in range(0, len(a)):
        if idx == i:
            a[i] //= 2
        elif a[i] * 3 > 1000000000:
            if a[i] % 2 == 0:
                a[i] //= 2
            else:
                break
        else:
            a[i] *= 3
    cnt += 1
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
import sys

sys.stdin.readline()
a = list(map(int, sys.stdin.readline().split()))

def largest_odd_idx(A):
    idx = -1
    max_a = 0
    for i, v in enumerate(A):
        if v % 2 == 0 and max_a < v:
            max_a = v
            idx = i
    return idx

cnt = 0
while True:
    idx = largest_odd_idx(a)
    if idx < 0:
        break
    for i in range(0, len(a)):
        if idx == i:
            a[i] //= 2
        else:
            a[i] *= 3
    cnt += 1
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
tmp = input()
count = 0
for i in range(N):
    tmp_l = int(tmp.split(' ')[i])
    while(tmp_l % 2 == 0):
        count += 1
        tmp_l = tmp_l / 2

print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A = [int(i) for i in input().split()]
count = 0
flag = 1
while flag != 0:
    flag = 0
    for i, a in enumerate(A):
        if a % 2 == 0:
            A[i] = a/2
            count += 1
            flag = 1
            break
print(count)

Submission status: Time Limit Exceeded

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

s = 1
count = 0

for i in xrange(0,n):
	if a[i]%2 == 0:
		s *= a[i]
		s = s >> 1
		count += 1

while(s%2 == 0):
	s = s >> 1
	count += 1

print count

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
arr = list(map(int,input().split()))
ans = 0
def odd(arr):
    for i in arr:
        if i % 2 == 0:
            return True
            break
    return False

while odd(arr):
    maxOdd = max(list(filter(lambda x: x % 2 == 0, arr)))
    arr[arr.index(maxOdd)] = arr[arr.index(maxOdd)] // 2
    arr = list(map(int,arr))
    arr = list(map(lambda arr:arr * 3, arr))
    ans += 1

print(ans)

Submission status: Time Limit Exceeded

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

ans = 0

A1_N = functools.reduce(lambda x, y: x*y, A)
while A1_N % 2 == 0:
    A1_N = A1_N // 2
    ans += 1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
tmp = input()
a_list = []
for i in range(N):
    a_list.append(int(tmp.split(' ')[i]))

count = 0
for l in a_list:
    tmp_l = l
    while(tmp_l % 2 == 0):
        count += 1
        tmp_l = tmp_l / 2

print(count)

Submission status: Time Limit Exceeded

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

s = 1
count = 0

for i in xrange(0,n):
	if a[i]%2 == 0:
		s *= a[i]

while(s%2 == 0):
	s = s >> 1
	count += 1

print count

Submission status: Time Limit Exceeded

Solution code:
def is_even(a):
    return [ai%2 == 0 for ai in a]

N = int(raw_input())
a = [int(s) for s in raw_input().split()]

counter = 0
any_even = is_even(a)

while sum(any_even) > 0:
    even_min_idx, eve_min = min([(i, a[i]) for i in range(N) if any_even[i]])

    for i in range(N):
        if a[i] % 2 == 1:
            a[i] = 3*a[i]
        elif i == even_min_idx:
            a[i] /= 2
        else:
            a[i] *= 3
    counter += 1
    any_even = is_even(a)

print counter

Submission status: Time Limit Exceeded

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

#偶数のaだけ取り出す
a_even = []
for a in a_list:
	if a % 2 == 0:
		a_even.append(a)

times = 0

while len(a_even) > 0:
	a_even[0] /= 2
	times += 1

	if a_even[0] % 2 == 1:
		a_even.pop(0)
	else:
		a = [a_even[0]] + [i*2 for i in a_even[1:]]

print(times)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
tmp = input()
a_list = []
for i in range(N):
    a_list.append(int(tmp.split(' ')[i]))

# print(a_list)


count = 0
for l in a_list:
    tmp_l = l
    while(tmp_l % 2 == 0):
        count += 1
        tmp_l = tmp_l / 2

print(count)

Submission status: Time Limit Exceeded

Solution code:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

n = ni()
a = na()
ans = 0
while True:
    dtwo = 0
    for i in range(n):
        if a[i] % 2 == 0 and dtwo == 0:
            a[i]//=2
            dtwo = 1
        else:
            a[i]*=3
    if dtwo == 0:
        break
    ans += 1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
l=list(map(int, input().split()))
c=0
def a(n, l):
    result=False
    num=0
    for i in range(n):
        if l[i]%2==0:
            result=True
            num=i
            break
    return result, num
while True:
    b=a(n, l)
    if b[0]:
        c+=1
        l=list(map(lambda x: x*3, l))
        l[b[1]]//=6
    else:
        break
print(c)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
a = list(map(int, input().split()))
isCon = True
counter = 0
while(isCon):
    isDiv = False
    for i in range(len(a)):
        if(not isDiv and a[i]%2==0):
            a[i] = a[i]//2
            isDiv = True
        else:
            a[i] = a[i]*3
    if(not isDiv):
        isCon = False
    else:
        counter += 1
print(counter)

Submission status: Time Limit Exceeded

Solution code:

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

def soinsuubunkai(N):
    num_ = N
    list_ = []
    for k in range(2, N+1):
        while True:
            if num_ % k == 0:
                list_.append(k)
                num_ = num_ // k
            else:
                break
    return list_

counter = 0
for a in A:
    tmp = soinsuubunkai(a)
    counter += tmp.count(2)

print(counter)

Submission status: Time Limit Exceeded

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

s = 0
while True:
    divided = False
    for i in range(n):
        if a[i] % 2 == 0:
            a[i] //= 2
            divided = True
            break
    if divided:
        s += 1
    else:
        break
print(s)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

tmp = 1
m = 0
for ai in a_list:
    if ai % 2 == 0:
        tmp *= ai
        m += 1

ans = 0
while True:
    if tmp % (2**m) == 0:
        tmp //= (2**m)
        ans += m
    else:
        break

for i in range(1, m+1):
    if tmp % 2 == 0:
        tmp //= 2
        ans += 1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-


def can_div2(a):
    for i in range(len(a)):
        if a[i] % 2 == 0:
            a[i] /= 2
            return True
    else:
        return False

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

c = 0

while(can_div2(a)):
   c += 1 

print(c)

Submission status: Time Limit Exceeded

Solution code:
# https://abc100.contest.atcoder.jp/tasks/abc100_c


def get_primes_dic(v):
    m = {}
    i = 2

    while i <= v:
        while v % i == 0:
            if i in m:
                m[i] += 1
            else:
                m[i] = 1
            v //= i

        i += 1

    return m


N = int(input())

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

count = 0

for i in a:
    dic = get_primes_dic(i)
    if 2 in dic:
        count += dic[2]

print(count)

Submission status: Accepted

Solution code:
import sys
import math
from collections import defaultdict, deque, Counter
from copy import deepcopy
from bisect import bisect, bisect_right, bisect_left
from heapq import heapify, heappop, heappush
    
input = sys.stdin.readline
def RD(): return input().rstrip()
def F(): return float(input().rstrip())
def I(): return int(input().rstrip())
def MI(): return map(int, input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def LF(): return list(map(float,input().split()))
def Init(H, W, num): return [[num for i in range(W)] for j in range(H)]

def main():
    N = I()
    L = LI()
    ans = 0
    
    for i in L:
        while True:
            if i % 2==0:
                i //=2
                ans+=1
            else:
                break
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline
import numpy as np

def main():
    n = int(input())
    numbers=list(map(int,input().split()))
    numbers=np.array(numbers)
    count=0
    
    if np.all(numbers%2==1):
        print(0)
        exit()
    while True:
        if np.all(numbers%2==1)==True:
            break
        else:
            idx=np.where(numbers%2==0)
            count+=np.count_nonzero(numbers%2==0)
            numbers[idx]=numbers[idx]//2
    print(count)

if __name__=="__main__":
    main()

Submission status: Accepted

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

lst = []
for i in a:
    if i%2 == 0:
        lst.append(i)

def half(x):
    cnt = 0
    for i in range(x):
        if x%2 == 0:
            x = x//2
            cnt += 1
        else:
            break
    return cnt

ans = 0
for i in lst:
    ans += half(i)
    
print(ans)

Submission status: Accepted

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

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] //= 2
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
#n, W = map(int, input().split())
al = list(map(int, input().split()))
#al=[list(input()) for i in range(n)]


def div2(v, a):
    res = 0
    if v == 0:
        return res
    while v % a == 0:
        v = v//a
        res += 1
    return res


ans = 0
for a in al:
    ans += div2(a, 2)
print(ans)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    A = list(map(int, input().split()))
    ans = 0
    for a in A:
        for i in range(1, 31):
            if a%(2**i) != 0:
                ans += i-1
                break
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:

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

# a_i /2 or x3
# すべてint, すべてx3はだめ

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

# 素因数の中に2がいくつ入っているか。
fact_list = []
for item in a:
    fact_list += prime_factorize(item)

print(fact_list.count(2))

Submission status: Accepted

Solution code:
#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
import heapq
from fractions  import gcd
#input=sys.stdin.readline
#import bisect
n=int(input())
a=list(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()))
ans = 0
for i in A:
  n = i
  while n % 2 == 0:
    n //= 2
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8


def main():
    _ = int(input())
    A = list(map(int, input().split()))
    ans = 0

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

    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
n=int(input())
cnt=0
a_list=list(map(int,input().split()))
for i in range(n):
    while True:
        if a_list[i]%2==0:
            cnt+=1
            a_list[i]=a_list[i]/2
        else:
            break
    cnt=max(cnt,0)
print(cnt)

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())
N_List = list(map(int,input().split()))
cnt = 0
while len(N_List) != 0:
    N_List = [i//2 for i in N_List if i % 2 == 0].copy()
    cnt += len(N_List)
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

def check(p):
  c = 0
  while p % 2 == 0:
    c += 1
    p //= 2
  return c

res = 0
for i in range(n):
  res += check(a[i])
print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# import sys
# sys.recursionlimit(10**7)
from functools import reduce

def divideCount(k):
    cnt = 0
    while k % 2 == 0:
        k //= 2
        cnt += 1
    return cnt

def solve(a):
    return sum(
        map(
            divideCount,a
        )
    )


def main():
    _ = int(input())
    a = list(map(int,input().split()))
    print('{}'.format(solve(a)))




if __name__ == '__main__':
  main()

Submission status: Accepted

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

Submission status: Accepted

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

def cal(x):
  if x % 2 != 0: return 0
  return cal(x//2)+1
  
for l in L:
  ans += cal(l)

print(ans)

Submission status: Accepted

Solution code:
N,*A = map(int,open(0).read().split())

cnt = 0
for a in A:
  for n in range(1,31):
    if a%(2**n)!=0:
      cnt += n-1
      break
print(cnt)

Submission status: Accepted

Solution code:
import math
from math import gcd,pi,sqrt
INF = float("inf")
MOD = 10**9 + 7

import sys
sys.setrecursionlimit(10**6)
import itertools
import bisect
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]


def main():
    n = i_input()
    l = i_list()
    ans = 0
    for i in l:
        while i%2 == 0:
            ans += 1
            i //= 2
    print(ans)



if __name__=="__main__":
    main()

Submission status: Accepted

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

c=0

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 18 10:08:18 2020

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

Submission status: Accepted

Solution code:
input()
print(sum([len(bin(a&-a))-3 for a in map(int,input().split())]))

Submission status: Accepted

Solution code:
input()
print(sum(map(lambda a:len(bin(int(a)&-int(a)))-3,input().split())))

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] = A[i]//2
    
print(ans)

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:
N=int(input())
A=list(map(int, input().split()))
counter=[]
for num in range(len(A)):
  counter.append(0)
for num in range(len(A)):
  while A[num]%2==0:
    A[num]=A[num]/2
    counter[num]+=1
print(sum(counter))

Submission status: Accepted

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

count = 0
for i in a:
  count += len(bin(i)) - bin(i).rfind("1") - 1

print(count)

Submission status: Accepted

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


if __name__ == '__main__':
    main()

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]>>=1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

if __name__ == "__main__":
    solve()

Submission status: Accepted

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

def findout(n):
  cnt = 0
  while n % 2 == 0:
    n = n // 2
    cnt += 1
    
  return cnt

A = [findout(s) for s in S]
print(sum(A))

Submission status: Accepted

Solution code:
# row = [int(x) for x in input().rstrip().split(" ")]
# n = int(input().rstrip())
# s = input().rstrip()

def resolve():
    import sys
    input = sys.stdin.readline

    n = int(input().rstrip())
    a_list = [int(x) for x in input().rstrip().split(" ")]

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

    print(ans)

if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
N = int(input())
As = input().split(' ')
As = [int(As[i]) for i in range(N)]
EVEN = 0
for i in range(N):
  if As[i]%2 == 0:
    while As[i]%2 == 0:
      As[i] /= 2
      EVEN += 1
print(EVEN)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

def factorize(n):
    if n == 2:
        return [2]
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        break
    return fct


input = sys.stdin.readline

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

count_2 = 0
for a in a_list:
    count_2 += len(factorize(a))

print(count_2)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

cnt = 0

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

print(cnt)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

M = []
for i in A:
    if i % 2 == 0:
        M.append(i)

ans = 0
for j in M:
    while j%2 == 0:
        j //= 2
        ans += 1

print(ans)

Submission status: Accepted

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

def f_2(i):
  ans = 0
  while i % 2 == 0:
    ans += 1
    i //= 2
  return ans

ans = 0
for i in a:
  ans += f_2(i)
  
print(ans)