Buggy python submission (verdict: Time Limit Exceeded):
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)

Fixed submission:
import math
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
for x in a:
    while x % 2 == 0:
        x //= 2
        cnt += 1

print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
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)

Fixed submission:
import math
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
for x in a:
    while x % 2 == 0:
        x //= 2
        cnt += 1

print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
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)

Fixed submission:
import math
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
for x in a:
    while x % 2 == 0:
        x //= 2
        cnt += 1

print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
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)

Fixed submission:
import math
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
for x in a:
    while x % 2 == 0:
        x //= 2
        cnt += 1

print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
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)

Fixed submission:
import math
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
for x in a:
    while x % 2 == 0:
        x //= 2
        cnt += 1

print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
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)

Fixed submission:
import math
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
for x in a:
    while x % 2 == 0:
        x //= 2
        cnt += 1

print(cnt)