Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

def get_nearest(point, lst):
    shortest = 1000000000000000
    nearest = float("inf")
    for x in lst:
        dist = abs(x - point)
        if dist < shortest:
            shortest = dist
            nearest = x
    return nearest

def exist_between(a, b, lst):
    for x in lst:
        if a <= x and x <= b:
            return True
    else:
        return False

A, B, Q = [int(x) for x in input().split(" ")]
a = []
b = []
for i in range(A):
    a.append(int(input()))
for i in range(B):
    b.append(int(input()))
for i in range(Q):
    q = int(input())
    nearest_a = get_nearest(q, a)
    nearest_b = get_nearest(q, b)
#   print(q, nearest_a, nearest_b)
    
    if abs(nearest_a - q) < abs(nearest_b - q):
        nearer, farer = nearest_a, nearest_b
        nearer_list, farer_list = a, b
    else:
        nearer, farer = nearest_b, nearest_a
        nearer_list, farer_list = b, a

    nearer_first  = abs(q - nearer)
    nearer_first += abs(nearer - get_nearest(nearer, farer_list))

    farer_first  = abs(q - farer)
    farer_first += abs(farer - get_nearest(farer, nearer_list))

    answer = min(nearer_first, farer_first)

    print(answer)

### FIXED CODE ###

import bisect
A, B, Q = map(int, input().split())
INF = 10 ** 18
s = [-INF] + [int(input()) for i in range(A)] + [INF]
t = [-INF] + [int(input()) for i in range(B)] + [INF]
for q in range(Q):
    x = int(input())
    b, d = bisect.bisect_right(s, x), bisect.bisect_right(t, x)
    res = INF
    for S in [s[b - 1], s[b]]:
        for T in [t[d - 1], t[d]]:
            d1, d2 = abs(S - x) + abs(T - S), abs(T - x) + abs(S - T)
            res = min(res, d1, d2)
    print(res)
### BUGGY CODE ###

n = int(input())
mt = []
mt.append(int(input()))
mt.append(int(input()))
mt.append(int(input()))
mt.append(int(input()))
mt.append(int(input()))

nums = [0] * 6

time = 0
nums[0] = n
next_nums = nums[:]
while nums[5] < n:
  for i in range(5):
    d = min(nums[i], mt[i])
    next_nums[i] -= d
    next_nums[i + 1] += d
  time += 1
  for i in range(6):
    nums[i] = next_nums[i]

print(time)

### FIXED CODE ###

n = int(input())
mt = []
mt.append(int(input()))
mt.append(int(input()))
mt.append(int(input()))
mt.append(int(input()))
mt.append(int(input()))

print(5 + (n - 1) // min(mt))
### BUGGY CODE ###

import numpy as np

N = int(input())
A = np.array([int(i) for i in input().split()])

u = list(np.unique(A))
c = []
sum = 0
for j in u:
    _ = len(np.where(A == j)[0])
    c.append(_)
    sum += int(_ * (_ - 1) / 2)

for k in range(N):
    v = c[u.index(A[k])]
    print(sum - v + 1)

### FIXED CODE ###

import collections

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

u = collections.Counter(A)
sum = 0
for j, c in u.items():
    sum += int(c * (c - 1) / 2)

s = ""
for k in A:
    s += str(sum - u[k] + 1) + "\n"
print(s)
### BUGGY CODE ###

a, b = map(int, input().split())
ans = 1
for i in range(a,(b+1)):
    ans = ans*i

if ans > 0:
    print("Positive")
elif ans < 0:
    print("Negative")
else:
    print("Zero")

### FIXED CODE ###

a, b = [int(x) for x in input().split()]

if a > 0:
    print('Positive')
elif a <= 0 and 0 <= b:
    print('Zero')
elif (b - a) % 2 == 0:
    print('Negative')
else:
    print('Positive')
### BUGGY CODE ###

import math
a, b, n = map(int, input().split())

ans = 0

for i in range(1, n+1):
    ans = max(ans, math.floor(a*i/b) - a * math.floor(i/b))

print(ans)

### FIXED CODE ###

def f(a, b, n):
    return int(a*n/b) - a*int(n/b)

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

print(f(a, b, b-1) if n >= b-1 else f(a, b, n))
### BUGGY CODE ###

n, k = (int(i) for i in input().split())
a = [int(i) for i in input().split()]

dic = list(set(a))
if len(dic) <= k:
    print(0)
    exit()

n_ = len(dic) - k

count_list = []
for i in dic:
    count_list.append(a.count(i))

print(sum(sorted(count_list)[:n_]))


### FIXED CODE ###

n, k = (int(i) for i in input().split())
a = [int(i)-1 for i in input().split()]

import collections
c = collections.Counter(a)
values, counts = zip(*c.most_common(k))
print(n-sum(counts))
### BUGGY CODE ###

inf =  1100000
def main():
  N =  int(input())
  a = list(map(int, input().split()))
  a.sort()
  detect = [0] *inf
  for x in a:
    if detect[x] != 0:
      detect[x] = 2
    for i in range(x, inf, x):
      detect[i] += 1
  ans = 0
  for i in range(N):
    if detect[a[i]] == 1:
      ans += 1
  print(ans)
  
if __name__ == "__main__":
  main()

### FIXED CODE ###

inf =  1100000
def main():
  N =  int(input())
  a = list(map(int, input().split()))
  a.sort()
  detect = [0] *inf
  for x in a:
    if detect[x] != 0:
      detect[x] = 2
      continue
    for i in range(x, inf, x):
      detect[i] += 1
  ans = 0
  for i in range(N):
    if detect[a[i]] == 1:
      ans += 1
  print(ans)
  
if __name__ == "__main__":
  main()
### BUGGY CODE ###

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

mx = 0
mx_a = []
for i in range(n-k+1):
  t = p[i:i+k]
  st = sum(t)
  if st > mx:
    mx = st
    mx_a = t
ans = 0
for i in range(k):
  a = mx_a[i]
  ans += ((a * (a+1)) // 2) / a
print(ans)
# print(mx_a)

### FIXED CODE ###

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

# 累積和
c = [0] * (n+1)
for i in range(n):
  c[i+1] = c[i] + p[i]
#print(c)
mx = 0
mx_i = -1
for i in range(n-k+1):
  st = c[i+k] - c[i]
  if st > mx:
    mx = st
    mx_i = i
ans = 0
for i in range(mx_i, mx_i+k):
  a = p[i]
  ans += ((a * (a+1)) // 2) / a
print(ans)
# print(mx_a)
### BUGGY CODE ###

def main():
    from itertools import zip_longest
    n, k, *a = map(int, open(0).read().split())
    a.append(k)
    *b, = map(lambda x: bin(x)[2:].zfill(len(bin(max(a))) - 2), a)

    f = False
    m = ''
    for t in zip_longest(*b):
        g = t[-1]
        h = '0' if t[:-1].count('1') > n / 2 else '1'
        if (f, g, h) == (False, '1', '0'):
            f = True
        if f:
            m += h
        else:
            m += g

    x = int(m, 2)
    ans = sum(x ^ i for i in a[:-1])
    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    n, k, *a = map(int, open(0).read().split())

    cnt = [sum((x >> i) & 1 for x in a) for i in range(40)]
    bits = [0 if i > n - i else 1 for i in cnt]

    base = format(k, 'b')
    l = len(base)
    tmp = []

    if sum(2 ** i for i, b in enumerate(bits[:l]) if b == 1) > k:
        for i in range(l - 1, -1, -1):
            if int(base[-i - 1]) < bits[i]:
                bits[i] = 0
                tmp.append(sum(2 ** j for j, b in enumerate(bits[:l]) if b == 1))
    else:
        tmp.append(sum(2 ** j for j, b in enumerate(bits[:l]) if b == 1))

    ans = max(sum(i ^ x for x in a) for i in tmp if i <= k)
    print(ans)


if __name__ == '__main__':
    main()
### BUGGY CODE ###

from collections import deque
import sys
input = sys.stdin.readline
    
def bfs(v, N, G, E):
    queue = deque()
    new_color = 1
    used_color = set()
    num_used_color = 0
    node2colors = [set() for _ in range(N)]
    queue.append(v)
    while queue:
        q = queue.popleft()
        # print("q",q)
        num_color_from_q = 0
        while G[q]:
            nex = G[q].popleft()
            rest = num_used_color - num_color_from_q
            # print(rest)
            if rest > 0:
                usd_c = used_color - node2colors[q]
                if usd_c:
                    # print(used_color, node2colors[q])
                    usd_c = min(usd_c)
                    E[(q, nex)][1] = usd_c
                    node2colors[q].add(usd_c)
                    num_color_from_q += 1
                    node2colors[nex].add(usd_c)
                else:
                    # print(num_used_color, num_color_from_q)
                    new_c = new_color
                    new_color += 1
                    num_used_color += 1
                    E[(q, nex)][1] = new_c
                    node2colors[q].add(new_c)
                    num_color_from_q += 1
                    node2colors[nex].add(new_c)
                    used_color.add(new_c)
                    
            else:
                new_c = new_color
                new_color += 1
                num_used_color += 1
                E[(q, nex)][1] = new_c
                node2colors[q].add(new_c)
                num_color_from_q += 1
                node2colors[nex].add(new_c)
                used_color.add(new_c)
        
            queue.append(nex)
    return num_used_color

def main():
    N = int(input())
    G = [deque() for _ in range(N)]
    E = dict() # (a, b) -> [idx, color]
    for i in range(N-1):
        a, b = map(lambda x: int(x)-1, input().split())
        G[a].append(b)
        E[(a, b)] = [i, 0]
    K = bfs(0, N, G, E)
    # ans_list = [value for value in E.values()]
    print(K)
    for value in E.values():
        print(value[1])
main()

### FIXED CODE ###

from collections import deque
import sys
input = sys.stdin.readline
    
def bfs(v, N, G, E):
    visited = [0]*N
    queue = deque()
    K = -1
    node2color = [-1 for _ in range(N)]
    queue.append(v)
    visited[v] = 1
    while queue:
        q = queue.popleft()
        color = 0
        for nex in G[q]:
            if visited[nex]:
                continue
            visited[nex] = 1
            color += 1
            if color == node2color[q]:
                color += 1
            
            node2color[nex] = color
            E[(min(q, nex), max(q, nex))] = color
            queue.append(nex)
        K = max(K, color)
    return K

def main():
    N = int(input())
    G = [deque() for _ in range(N)]
    E = dict() # (a, b) -> [idx, color]
    for i in range(N-1):
        a, b = map(lambda x: int(x)-1, input().split())
        G[a].append(b)
        G[b].append(a)
        E[(a, b)] = 0
    K = bfs(0, N, G, E)
    # ans_list = [value for value in E.values()]
    print(K)
    for value in E.values():
        print(value)
main()
### BUGGY CODE ###

import sys
sys.setrecursionlimit(200000)
n,q = map(int,input().split())
y = [[] for _ in range(n)]
c = [0 for _ in range(n)]
for _ in range(n-1):
  ai,bi = map(int,input().split())
  y[ai-1].append(bi-1)
  y[bi-1].append(ai-1)
for _ in range(q):
  pi,xi = map(int,input().split())
  c[pi-1] += xi
def f(j,b):
  for yj in y[j]:
    if yj != b:
      c[yj] += c[j]
      f(yj,j)
f(0,-1)
for i in range(n):
  print(c[i],end=" ")
    
  
  

### FIXED CODE ###

from collections import deque
def submit():
  n,q = map(int,input().split())
  y = [[] for _ in range(n)]
  c = [0]*n
  for _ in range(n-1):
    ai,bi = map(int,input().split())
    y[ai-1].append(bi-1)
    y[bi-1].append(ai-1)
  for _ in range(q):
    pi,xi = map(int,input().split())
    c[pi-1] += xi
  z = deque([[0,-1]])
  while z:
    j,b = z.popleft()
    for yj in y[j]:
      if yj != b:
        z.append([yj,j])
        c[yj] += c[j]
  for i in range(n):
    print(c[i],end=" ")
submit()
### BUGGY CODE ###

import itertools
H, W, M = map(int, input().split())
Hsum = [0] * H
Wsum = [0] * W
hw = []
for m in range(M):
  h, w = map(int, input().split())
  Hsum[h-1] += 1
  Wsum[w-1] += 1
  hw.append(str(h-1)+"_"+str(w-1))

hmax_ind = list(map(lambda x: True if x == max(Hsum) else False, Hsum))
hmax_ind = list(itertools.compress(range(len(Hsum)), hmax_ind))
wmax_ind = list(map(lambda x: True if x == max(Wsum) else False, Wsum))
wmax_ind = list(itertools.compress(range(len(Wsum)), wmax_ind))

res = []
for n in itertools.product(hmax_ind, wmax_ind):
  res.append(str(n[0])+"_"+str(n[1]))

if len(set(res).intersection(set(hw))) == len(res):
  print(max(Hsum) + max(Wsum)-1)
else:
  print(max(Hsum) + max(Wsum))


### FIXED CODE ###

import sys
input = sys.stdin.readline
 
H, W, M = map(int, input().split())
Hsum = [0] * H
Wsum = [0] * W
hw = set()
for m in range(M):
  h, w = map(lambda x: int(x) - 1, input().split())
  Hsum[h] += 1
  Wsum[w] += 1
  hw.add((h, w))

mh = max(Hsum)
mw = max(Wsum)
hidx = [i for i, _ in enumerate(Hsum) if _ == mh]
widx = [i for i, _ in enumerate(Wsum) if _ == mw]
 
if len(hidx) * len(widx) > M:
  print(mh + mw)
else:
  fi_flg = False
  for h in hidx:
    for w in widx:
      if (h, w) not in hw:
        print(mh + mw)
        fi_flg = True
        break
    if fi_flg:
      break
  if fi_flg is False:
    print(mh + mw - 1)
### BUGGY CODE ###

import numpy as np

H,W = list(map(int,input().split()))
INFTY = 10000
A = np.array([[0 if c=="#" else INFTY for c in input()]for _ in range(H)] )

for i in range(H+W):
    A[:-1] = np.min((A[:-1],A[1:]+1),0)
    A[1:] = np.min((A[1:],A[:-1]+1),0)
    A[:,:-1] = np.min((A[:,:-1],A[:,1:]+1),0)
    A[:,1:] = np.min((A[:,1:],A[:,:-1]+1),0)
print(np.max(A))

### FIXED CODE ###

H,W = list(map(int,input().split()))
A = [list(input()) for _ in range(H)]

q = []
for i in range(H):
    for j in range(W):
        if A[i][j] == "#":
            q.append((i,j))
            A[i][j] = 0
ans = 0
k = 0
while k < len(q):
    i,j = q[k]
    v = A[i][j]
    if i>0 and A[i-1][j]==".":
        A[i-1][j] = v + 1
        q.append((i-1,j))
        ans = max(ans,v+1)
    if i<H-1 and A[i+1][j]==".":
        A[i+1][j] = v + 1
        q.append((i+1,j))
        ans = max(ans,v+1)
    if j>0 and A[i][j-1]==".":
        A[i][j-1] = v + 1
        q.append((i,j-1))
        ans = max(ans,v+1)
    if j<W-1 and A[i][j+1]==".":
        A[i][j+1] = v + 1
        q.append((i,j+1))
        ans = max(ans,v+1)
    k += 1
print(ans)
### BUGGY CODE ###

N, M = map(int, input().split())
number, value = 0, 0
A_list, B_list = [], []
for i in range(N):
    A, B = map(int, input().split())
    A_list.append(A)
    B_list.append(B)
for i in range(N):
    A_value = min(A_list)
    A_index = A_list.index(min(A_list))
    value += A_value * B_list[A_index]
    number += B_list[A_index]
    del A_list[A_index]
    del B_list[A_index]
    if number > M:
        sabun = number - M
        value -= sabun * A_value
        break
print(value)

### FIXED CODE ###

N, M = map(int, input().split())
AB_list = [list(map(int, input().split())) for i in range(N)]
AB_list.sort()
ans, cnt = 0, 0
for a, b in AB_list:
    ans += a*b
    cnt += b
    if cnt > M:
        ans = ans-(a*(cnt-M))
        break
print(ans)
### BUGGY CODE ###

import numpy as np
from collections import deque



def read():
    N, Q = list(map(int, input().strip().split()))
    G = [list() for i in range(N+1)]
    PX = list()
    for i in range(N-1):
        a, b = list(map(int, input().strip().split()))
        G[a].append(b)
        G[b].append(a)
    for i in range(Q):
        px = list(map(int, input().strip().split()))
        PX.append(px)
    return N, Q, G, PX


def solve(N, Q, G, PX):
    C = [0 for i in range(N+1)]
    V = [0 for i in range(N+1)]
    for p, x in PX:
        C[p] += x
    depth = [-1 for i in range(N+1)]
    parents = [-1 for i in range(N+1)]
    q = deque()
    q.append(1)
    depth[1] = 0
    parents[1] = 0
    while len(q) > 0:
        node = q.pop()
        for neighbor in G[node]:
            if depth[neighbor] < 0:
                depth[neighbor] = depth[node] + 1
                parents[neighbor] = node
                q.append(neighbor)
    order = np.argsort(depth[1:]) + 1
    V[1] = C[1]
    for i in order:
        child = i
        parent = parents[i]
        V[child] = V[parent] + C[child]
    return ' '.join(map(str, V[1:]))
    

if __name__ == '__main__':
    inputs = read()
    print("{}".format(solve(*inputs)))


### FIXED CODE ###

import sys
sys.setrecursionlimit(200000)
from collections import deque


def read():
    N, Q = list(map(int, input().strip().split()))
    G = [list() for i in range(N+1)]
    PX = list()
    for i in range(N-1):
        a, b = list(map(int, input().strip().split()))
        G[a].append(b)
        G[b].append(a)
    for i in range(Q):
        px = list(map(int, input().strip().split()))
        PX.append(px)
    return N, Q, G, PX


def bfs(parent, G, C, V):
    q = deque()
    q.append(1)
    while len(q) > 0:
        parent = q.pop()
        V[parent] = True
        for child in G[parent]:
            if not V[child]:
                C[child] += C[parent]
                q.append(child)
    

def solve(N, Q, G, PX):
    C = [0 for i in range(N+1)]
    V = [False for i in range(N+1)]
    for p, x in PX:
        C[p] += x
    bfs(1, G, C, V)
    return ' '.join(map(str, C[1:]))
    

if __name__ == '__main__':
    inputs = read()
    print("{}".format(solve(*inputs)))
### BUGGY CODE ###

s = list(str(input()))
ans = 0
i = len(s) - 1 
while True:
    if i > len(s) - 1:
        i -= 1
    if i == 0:
        break
    if s[i] == "W" and s[i-1] == "B":
        s[i] = "B"
        s[i-1] = "W"
        ans += 1
        i += 1
    else:
        i -= 1
print(ans)

### FIXED CODE ###

s = list(str(input()))
count = 0
ans = 0
for i in s:
    if i == "B":
        count += 1
    else:
        ans += count
print(ans)
### BUGGY CODE ###

N = int(input())

power = 1
for i in range(N):
    power = power*(i+1)

print(power%(10**9+7))


### FIXED CODE ###

N = int(input())

power = 1
for i in range(N):
    power = power*(i+1)
    if power >= 10**5:
        power = power%(10**9+7)

print(power%(10**9+7))
### BUGGY CODE ###

def main():
    import sys
    input=sys.stdin.readline
    import numpy as np

    n,k=map(int,input().split())
    A=np.array(input().split(),dtype=np.int64)
    F=np.array(input().split(),dtype=np.int64)
    A.sort()
    F.sort()
    F=F[::-1]

    def ok(x): #チームの成績をxとするような修行の仕方が存在するか
        B=A-(x//F)
        return sum(B[B>0])<=k
    
    l=-1
    r=10**12+1
    while r-l>1:
        mid=(r+l)//2
        if ok(mid):
            r=mid
        else:
            l=mid
    print(r)   

if __name__=='__main__':
    main()



### FIXED CODE ###

import numpy as np
N, K = map(int, input().split())
A = np.array(input().split(), dtype=np.int64)
F = np.array(input().split(), dtype=np.int64)
A = np.sort(A)
F = np.sort(F)[::-1]


def C(x):
    train = np.maximum(0, A - x // F).sum()
    return train <= K


left = -1
right = 10 ** 12 + 1
while right > left + 1:
    mid = (right + left) // 2
    if C(mid):  # 食べきれる場合
        right = mid
    else:
        left = mid

ans = right
print(ans)
### BUGGY CODE ###

N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)

if N == 1:
    for i in range(M):
        A[0] = int(A[0] / 2)

else:
    for i in range(M):
        A[0] = int(A[0] / 2)
        if A[0] < A[1]:
            A.sort(reverse=True)

print(sum(A))


### FIXED CODE ###

def pushHeap(array, elem):
    n = len(array)
    array.append(elem)
    while n != 0:
        i = int((n - 1) / 2)
        if array[n] > array[i]:
            tmp = array[n]
            array[n] = array[i]
            array[i] = tmp
        n = i


def popHeap(array):
    n = len(array) - 1
    array[0] = array[n]
    del array[-1]
    i = 0
    while 2 * i + 1 < n:
        j = 2 * i + 1
        if j != n - 1 and array[j] < array[j + 1]:
            j += 1
        if array[i] < array[j]:
            tmp = array[j]
            array[j] = array[i]
            array[i] = tmp
        i = j


N, M = map(int, input().split())
A = list(map(int, input().split()))
heap_A = []

for a in A:
    pushHeap(heap_A, a)

for _ in range(M):
    discount_max = int(heap_A[0] / 2)
    popHeap(heap_A)
    pushHeap(heap_A, discount_max)

print(sum(heap_A))
### BUGGY CODE ###

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

ans = 0
for i in range(K, N+1, K):
    for j in range(K, N+1, K):
        for k in range(K, N+1, K):
            ans += 1
if K % 2 == 0:
    for i in range(1, N+1):
        if i % K != K // 2:
            continue
        for j in range(1, N+1):
            if j % K != K // 2:
                continue
            for k in range(1, N+1):
                if k % K != K // 2:
                    continue
                ans += 1
print(ans)

### FIXED CODE ###

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

ans = 0
cnt = 0
for i in range(K, N+1, K):
    cnt += 1
ans += pow(cnt, 3)

if K % 2 == 0:
    cnt = 0
    for i in range(K//2, N+1, K):
        cnt += 1
    ans += pow(cnt, 3)
print(ans)
### BUGGY CODE ###

#A,B,C,D=map(int,input().split(" "))

mod=2019
a=input()

N=len(a)
t=[]
ans=0

for i in range(N):
  for j in range(i+1,N+1):
    u=int(a[i:j])
    #print(u)
    if (u % mod)==0:
      ans+=1
      #print(i+1,j)

print(ans)


### FIXED CODE ###

mod=2019
a=input()

N=len(a)
t=[0]*mod
t[0]=1

w=1
u=0

for i in range(N):
  u=int(a[N-1-i]) * w + u
  v=u % mod
  t[v] += 1
  w *=10
  w %= mod

ans=0
for i in t:
  ans += (i-1)*i//2

print(ans)
### BUGGY CODE ###

n = int(input())
a = [int(i) for i in input().split()]
xor = [0 for i in range(n)]
sum = [0 for i in range(n)]

count = n
for j in range(n-1):
    xor[j] = a[j]
    sum[j] = a[j]
    for i in range(j+1, n):
        xor[i] = xor[i - 1] ^ a[i]
        sum[i] = sum[i-1] + a[i]
        if xor[i] == sum[i]:
            count += 1
        else:
            break
print(count)


### FIXED CODE ###

def evaluate(digit):
    _digit = str(format(digit, "b"))
    print(_digit)
    for i in range(len(_digit)):
        if int(_digit[i]) > 1:
            return False
    return True

def func(n, a):
    digit = 0
    count = 0
    i = 0
    j = 0
    while j < n:
        while j < n:
            if digit ^ a[j] == digit + a[j]:
                digit += a[j]
                count += j - i + 1
                # print("j i:{} j:{} count:{} digit:{}".format(i, j, count, format(digit, "b")))
                j += 1
            else:
                break
        while i < j < n:
            digit ^= a[i]
            i += 1
            break
        # print("_ i:{} j:{} count:{} digit:{}".format(i, j, count, format(digit, "b")))
    return count
"""
print(func(4, [2, 5, 4, 6]))
print(func(9, [0, 0, 0, 0, 0, 0, 0, 0, 0]))
print(func(19,[885, 8, 1, 128, 83, 32, 256, 206, 639, 16, 4, 128, 689, 32, 8, 64, 885, 969, 1]))
"""
digit = 0
n = int(input())
a = [int(i) for i in input().split()]
print(func(n, a))
### BUGGY CODE ###

N,K = map(int,input().split())
 
 
def modpow(a,n,mod):
    res = 1
    while n > 0:
        if n & 1:
            res = res * a % mod
        a = a * a % mod
        n >>= 1
    return res
 
def modinv(a,mod):
    return modpow(a,mod - 2,mod)
 
def cnk(a,b):
    MOD = 10**9+7
    ret = 1
    for i in range(b):
        ret *= (a-i)
        ret %= MOD
        ret = ret * modinv(i+1,MOD) % MOD
    return ret
 
 
for i in range(1,K+1):
    if i == 1:
        print(N-K+1)
    else:
        print(cnk(N-K+1,i)*cnk(K-1,i-1)%(10**9+7))

### FIXED CODE ###

import sys
input = sys.stdin.readline

def main():
    N,K = map(int,input().split())
     
    def modpow(a,n,mod):
        res = 1
        while n > 0:
            if n & 1:
                res = res * a % mod
            a = a * a % mod
            n >>= 1
        return res
     
    def modinv(a,mod):
        return modpow(a,mod - 2,mod)
     
    def cnk(a,b):
        MOD = 10**9+7
        ret = 1
        for i in range(b):
            ret *= (a-i)
            ret %= MOD
            ret = ret * modinv(i+1,MOD) % MOD
        return ret
     
     
    for i in range(1,K+1):
        if i > N - K +1:
            print(0)
        elif i == 1:
            print(N-K+1)
        else:
            print(cnk(N-K+1,i)*cnk(K-1,i-1)%(10**9+7))
if __name__ == '__main__':
    main()
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
even=[x for x in a if x%2==0]
ans=0
while even!=[]:
    delval=0
    even[0]//=2
    len_even=len(even)
    for i in range(len_even):
        if i==0:
            if even[i]%2!=0:
                del even[i]
                delval+=1
        else:
            if even[i-delval]%2!=0:
                del even[i-delval]
                delval+=1
    ans+=1
print(ans)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
ans=0
for i in a:
    buf=i
    ans+=format(buf,'b')[::-1].find('1')
print(ans)