peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
N = int(input())
A = list(map(int,input().split()))

cnt=0

for i in range(N):
    #print(cnt)
    if all(A) % 2 == 0:
        A = list(map(lambda x: x/2,A))
        #print(A)
    else:
        break
    cnt += 1
    
print(cnt)
# Judge status: Accepted
import sys
input = sys.stdin.readline
N = int(input())
L = list(map(int, input().split()))
if N == 1:
  print(0)
else:
  x = 0
  for i in range(0,len(L)-1):
    if L[i] > L[i + 1]:
      x = x + (L[i] - L[i + 1])
      L[i + 1] = L[i + 1] + (L[i] - L[i + 1])
  print(x)
# Judge status: Accepted
N, K = map(int, input().split())
P = list(map(int, input().split()))
Pe = [(i+1)/2 for i in P]

maxsum = -1
cur = sum(Pe[0:K])
maxsum = cur
for i in range(1, N-K+1):
    cur = cur - Pe[i-1] + Pe[i+K-1]
    if cur > maxsum:
        maxsum = cur

print(maxsum)
# Judge status: Accepted
a, b = [int(input().strip()) for i in range(2)]

ans = {1, 2, 3}

ans.remove(a)
ans.remove(b)

a = ans.pop()
print(a)
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
print(min(a, b+c))
# Judge status: Wrong Answer
# https://atcoder.jp/contests/abc134/tasks/abc134_e　

from bisect import bisect_left

N = int(input())

A = [int(input()) for _ in range(N)]

LIS = [A[0]]
cnt = 0

for a in A:
    if a > LIS[-1]:
        LIS.append(a)
    else:
        ind = bisect_left(LIS, a)
        LIS[ind] = a
        if ind == 0:
            cnt += 1

print(cnt)
# Judge status: Accepted
x,n=map(int,input().split())
if n==0:
  print(x)
else:
  plist=list(map(int,input().split()))
  if x not in plist:
    print(x)
  else:
    
    for i in range(100000):
      if x-i-1 not in plist:
        print(x-i-1)
        break
      elif x+i+1 not in plist and x-i-1 in plist:
        print(x+i+1)
        break
# Judge status: Accepted
A, B, C = map(int, input().split())
print("Yes" if A<C<B or B<C<A else "No")
# Judge status: Accepted
x,y=map(int,input().split())
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
c=[2]
if ((x in a)and(y in a))\
    or((x in b)and(y in b))\
    or((x in c)and(y in c)):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
A, B, C = map(int, input().split())
if (3 * max(A, B, C) - (A + B + C)) % 2 == 0:
    print((3 * max(A, B, C) - (A + B + C)) // 2)
else:
    print((3 * max(A, B, C) - (A + B + C)) // 2 + 2)
# Judge status: Accepted
N, K = map(int, input().split(' '))
H_list = list(map(int, input().split(' ')))

H_list.sort(reverse = True)

del H_list[0:K]

print(sum(H_list))
# Judge status: Accepted
import collections
n=int(input())
a=list(map(int,input().split()))
c=collections.Counter(a)
for x in range(1,n+1):
    print(c[x])
# Judge status: Wrong Answer
x,k,d=[int(i) for i in input().strip().split(" ")]
if x//d>=k:
    print(x-d*k)
else:
    if (k-x//d)%2==0:
        print(x%d)
    else:
        print(d-(x%d))
# Judge status: Accepted
w = input()

dict_ = {}

for i in w:
    dict_.setdefault(i, 0)
    dict_[i] +=1

flg = True

for v in dict_.values():
    if v % 2 != 0:
        flg = False
        break
if flg:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a, b = [0], [0]
for i in range(N):
    a.append(a[i] + A[i])
for i in range(M):
    b.append(b[i] + B[i])

ans, j = 0, M
for i in range(N + 1):
    if a[i] > K:
    	break
    while b[j] > K - a[i]:
    	j -= 1
    ans = max(ans, i + j)
print(ans)
# Judge status: Accepted
n,m = map(int,input().split())
ans = [0] * n
for i in range(m):
  a,b = map(int, input().split())
  ans[a-1] += 1
  ans[b-1] += 1
for x in ans:
  print(x)
# Judge status: Wrong Answer
n = int(input())
p = list(map(int, input().split()))

a = range(1, n+1)
count = n

for i in range(n):
  if p[i]==a[i]:
    n -= 1

if n==2 or n==0:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    s=STR()
    l=len(s)
    ct=0
    for i in range(l//2):
        if s[i]!=s[-1-i]:
            ct+=1
    print(ct)
if __name__ == '__main__':
    do()
# Judge status: Accepted
from functools import reduce

x,y=list(map(int,input().split()))
mod = 10 ** 9 + 7

if (2 * y - x) % 3 != 0 or (2 * x - y) % 3 != 0:
  print("0")
  exit()
  
a,b = (2 * y - x) // 3, (2 * x - y) // 3 

r = min(a,b)

if r == 0:
  print("1")
elif r < 0:
  print("0")
else:
  numerator = reduce(lambda x, y: x * y % mod, range(a + b - r + 1, a + b + 1))
  denominator = reduce(lambda x, y: x * y % mod, range(1,r + 1))
  print(numerator * pow(denominator, mod - 2, mod) % mod)
# Judge status: Wrong Answer
n = int(input())
li = list(map(int,input().split()))
flag = 0
for i in range(n):
    if(li[i] % 2 == 0):
        if((li[i] % 3 == 0) or(li[i] % 5 == 0)):
            flag=1
        else:
            flag=0
            break
    else:
        flag=0
if(flag == 1):
    print('APPROVED')
else:
    print('DENIED')
# Judge status: Wrong Answer
x,y,a,b,c=map(int,input().split())
P=sorted(list(map(int,input().split())))[::-1]
Q=sorted(list(map(int,input().split())))[::-1]
R=sorted(list(map(int,input().split())))[::-1]+[0]*(max(x+y-c,0))
L=sorted(P[:x]+Q[:y])[::-1]
l=r=0
for i in range(x+y): 
    if r+R[i]<l+L[-i-1]:
        print(sum(L[:x+y-i]+sorted(L[x+y-i:]+R[:i])[::-1][:i]))
        exit()
    r+=R[i]
    l+=L[-i-1]
print(r)
# Judge status: Wrong Answer
A,B,C = map(int,input().split())
print(max(B//A,C))
# Judge status: Accepted
import math
n = int(input())
time = math.ceil(n / 1000)
ans = (time * 1000) - n
if ans <= 0:
    print(0)
else:
    print(ans)
# Judge status: Accepted
A, B, C = map(int, input().split())

limit = A - B
res = C - limit

if res < 0:
  print(0)
else:
  print(res)
# Judge status: Accepted
n = int(input())
d = {
	'AC': 0,
	'WA': 0,
	'TLE': 0,
	'RE': 0
}

for i in range(n):
  	d[input()] += 1

print('{} x {}'.format('AC', d['AC']))
print('{} x {}'.format('WA', d['WA']))
print('{} x {}'.format('TLE', d['TLE']))
print('{} x {}'.format('RE', d['RE']))
# Judge status: Accepted

url = "https://atcoder.jp//contests/abc116/tasks/abc116_b"

def calc(n):
    if n % 2 == 0:
        return n // 2
    else:
        return 3 * n + 1


def main():
    s = int(input())
    ans = [s]
    while True:
        tmp = calc(ans[-1])
        ans.append(tmp)
        if ans.index(tmp) != len(ans)-1:
            print(len(ans))
            break



if __name__ == '__main__':
    main()
# Judge status: Accepted

def resolve():
    N=int(input())
    S=len(set(map(int,input().split())))
    print("YES" if N==S else "NO")

if __name__ == "__main__":
    resolve()
# Judge status: Wrong Answer
n, m = map(int, input().split())

for i in range(n):
  a = input()
  
for j in range(m):
  b = input()
  
if b in a:
  print('Yes')
elif b == a:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
k=int(input())
x=100
count=0
while True:
  x+=(x/100)
  count+=1
  if (x>k) or (x==k):
    break
print(count)
# Judge status: Accepted

s=input()
def solution(s):
    new = []
    for c in s:
        if c == '0':
            new.append('0')
        elif c == '1':
            new.append('1')
        elif c == 'B':
            try:
                new.pop()
            except:
                pass
    newnew = ''.join(new)
    return newnew
print(solution(s))
# Judge status: Accepted
n = int(input())
pwr = 1
for i in range(n): 
    pwr *= 1*(i+1)
    pwr = pwr%(10**9+7)
print(pwr)
# Judge status: Wrong Answer
k = int(input())

def k_multipul_at(k: int) -> int:
  r = 7 % k
  cache = [r, 0]
  i = 1
  while r not in cache:
    r = (r * (10 % k) + 7 % k) % k
    cache.append(r)
    i += 1
  return -1 if r else i

print(k_multipul_at(k))
# Judge status: Accepted
li1= list(input())
li2= list(input())
if (li1[0]==li2[2])&(li1[1]==li2[1])&(li1[2]==li2[0]):
    print("YES")
else:
    print("NO")
# Judge status: Wrong Answer
a, b = map(int, input().split())
print(a%24+b)
# Judge status: Accepted
a, b = map(int, input().split())
if 1 <= a <= 9 and 1 <= b <= 9:
    print(a * b)
else:
    print(-1)
# Judge status: Accepted
N = input()
if N == 'ABC':
	print('ARC')
elif N == 'ARC':
	print('ABC')
else:
	print('eroor')
# Judge status: Wrong Answer
n = int(input())
s = input().split(")(")
l = ""
ans = ""
for i in range(len(s)):
    if len(s) != 1:
        if i % 2 == 0: s[i] += ")"
        else: s[i] = "(" + s[i]
    R = s[i].count(")")
    L = s[i].count("(")
    if R < L: ans += s[i] +  ")" * (L-R)
    elif L < R: ans += "(" * (R-L) + s[i]
    else: ans += s[i]
print(ans)
# Judge status: Accepted
N,K=map(int,input().split())
H=[int(input()) for i in range(N)]
H.sort()

ans=float('inf')
for i in range(N-K+1):
  ans=min(ans,H[i+K-1]-H[i])
print(ans)
# Judge status: Wrong Answer
def f(n):
    if n%2 == 0:
        return n//2
    else:
        return (3*n+1)

def ff(a1, history, n):
    a2 = f(a1)
    n += 1
    if a2 in history:
        return n

    history.append(a2)

    return ff(a2, history, n)

s = int(input())
print(ff(s,[],1))
# Judge status: Accepted
A,B=map(int,input().split())
count,outlet=0,1
while outlet<B:
    outlet-=1
    outlet+=A
    count+=1
print(count)
# Judge status: Accepted
from collections import Counter
n = int(input())
s = input()
ma = 0
for i in range(1,n):
    s1=s[:i]
    s2=s[i:]
    common = set(s1) & set(s2)
    ma = max(ma,len(common))
print(ma)
# Judge status: Wrong Answer
S = input()
if len(S) == 1:
    print('YES')
    exit()
if len(set(list(S))) == 1 or len(set(list(S))) == 2:
    print('NO')
    exit()
cnt = [S.count('a'),S.count('b'),S.count('c')]
if max(cnt)-min(cnt) <= 1:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
def main():
 n,m = map(int,input().split())
 if n == m:
     print('Yes')
 else:
     print('No')
main()
# Judge status: Accepted
n = int(input())

pay = 1000
while pay - n < 0:
    pay += 1000
print(pay - n)
# Judge status: Accepted
A = list(input())
B = list(input())
C = list(input())
now = A[0]
while True:
    if now == 'a':
        if len(A) == 0:
            print("A")
            break
        now = A.pop(0)
    if now == 'b':
        if len (B) == 0:
            print("B")
            break
        now = B.pop(0)
    if now == 'c':
        if len (C) == 0:
            print("C")
            break
        now = C.pop(0)
# Judge status: Wrong Answer
s,t = input().split()
print(s + t)
# Judge status: Accepted
N, M = map(int, input().split())
A = list(map(int, input().split()))
BC = []
for i in range(M):
  tmp = list(map(int, input().split()))
  BC.append(tmp)

A.sort()
BC.sort(key=lambda x: x[1], reverse=True)

j = 0
for i in range(M):
  count = 0
  while A[j] < BC[i][1]:
    A[j] = BC[i][1]			# 値を置き換える
    j += 1
    count += 1
    if count == BC[i][0] or j == N:
      break
  if j == N:
    break
print(sum(A))
# Judge status: Accepted
n = int(input())
p = list(map(int, input().split()))
q = [i for i in range(1, n+1)]
cnt = 0
for j in range(n):
    if p[j] == q[j]:
        if j != n-1:
            p[j], p[j+1] = p[j+1], p[j]
            cnt += 1
        else :
            p[j], p[j-1] = p[j-1], p[j]
            cnt += 1
print(cnt)
# Judge status: Accepted
l = int(input())

print((l / 3) ** 3)
# Judge status: Wrong Answer
S = input().strip()
print("A"+S[1][0]+"C")
# Judge status: Accepted
N=int(input())
S=list(map(int,input().split()))

first=S[0]
count=1
nagasa=len(S)

for i in range(1,nagasa):
    if S[i]<first:
        count+=1
        first=S[i]
        
print(count)
# Judge status: Accepted
A,B,C=sorted(input().split())

print(int(C+B)+int(A))
# Judge status: Accepted
s = raw_input()
print {(0,0):'NA', (0,1): 'YYMM', (1,0): 'MMYY', (1,1):'AMBIGUOUS'}[tuple(map(int,list(tuple([(0<int(s[2*i:2*i+2]) <= 12)	for i in range(2)]))))]
# Judge status: Wrong Answer
import itertools
import math


N = int(input())
P = list(map(int,input().split()))
Q = list(map(int,input().split()))

check = list(itertools.permutations(range(1,N+1)))
N_fac = math.factorial(N)

n1 = 0
n2 = 0
countP = 0
countQ = 0
for i in range(0,N_fac):
  for j in range(0,N):
    if(check[i][j] == P[j]):
      countP += 1
      if(countP == 3):
        n1 = i
    if(check[i][j] == Q[j]):
      countQ += 1
      if(countQ == 3):
        n2 = i
num = n1-n2
print(abs(num))
# Judge status: Wrong Answer
N,X,Y=map(int,input().split())
Z=Y-X

for k in range(1,N):
    ans=0
    if k<Z:
        ans+=N-k+min(k,N-Y+1)
        if 2*k+2<=Z:
            ans+=max(min(k-1,Z-k-3),0)+min(k-1,N-Y+1)
        if 2*k<Z+2:
            ans+=max(k-2,0)
    elif Z<=k<=N-Z:
        ans+=min(X,X-k+N-Y+1)

    print(ans)
# Judge status: Wrong Answer
n,m=map(int,input().split())
a=[]
for i in range(1,int(m**.5)+1):
    if m%i==0 and m//i>=n:a+=[i]
print(max(a))
# Judge status: Wrong Answer
a=[100]+[int(i) for i in input()]+[100]
n=len(a)
i=1
while i<len(a)-1:
    if a[i]^1==a[i+1]:
        a.pop(i)
        a.pop(i+1)
    if a[i]^1==a[i-1]:
        a.pop(i)
        a.pop(i-1)
    else:
        i+=1
print(n-len(a))
# Judge status: Accepted
from collections import defaultdict

S = input()
T = input()

S_dict, T_dict = defaultdict(list), defaultdict(list)
for i, s in enumerate(S):
    S_dict[s].append(i)
for i, t in enumerate(T):
    T_dict[t].append(i)

S_set, T_set = set(), set()
for s in S_dict.values():
    S_set.add(tuple(s))
for t in T_dict.values():
    T_set.add(tuple(t))

print('Yes' if S_set == T_set else 'No')
# Judge status: Wrong Answer
from itertools import permutations
N = int(input())
P = "".join(list(map(str,input().split())))
Q = "".join(list(map(str,input().split())))
ls = permutations(list(range(1,N+1)))
ans = []
for i in list(ls):
    ans.append("".join(list(map(str,i))))
a,b = 0,0
for i in range(len(ans)):
    if ans[i] == P:
        a = i
    elif ans[i] == Q:
        b = i
print(abs(int(a)-int(b)))
# Judge status: Accepted
def main():
  t = 0
  n,l = map(int, input().split())
  a = []
  for i in range(l, l+n):
    a.append(i)
  max = n + l - 1
  if max <= 0:
    t = max
  elif l >= 0:
    t = l
  else:
    t = 0
  print(sum(a)-t)

if __name__ == '__main__':
  main()
# Judge status: Wrong Answer
def main():
    n = int(input())
    c = input()
    w = c.count("W")
    ans = 0
    for i in range(n):
        target = "R" if i < w else "W"
        if c[i] != target:
            ans += 1
    print(ans // 2 if 0 < w < n else 0)


if __name__ == '__main__':
    main()
# Judge status: Accepted
N, D = list(map(int, input().split()))
ans = 0

for i in range(N):
    X, Y = list(map(int, input().split()))
    if (X**2 + Y**2) ** 0.5 <= D: ans += 1

print(ans)
# Judge status: Accepted
s=input()
cnt=0

for i in range(len(s)):#白黒白黒...
  if i%2==0:
    if s[i]=="0":
      cnt+=1

  else:
    if s[i]=="1":
      cnt+=1

print(min(cnt,len(s)-cnt))
# Judge status: Wrong Answer
def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    ans = 10**10
    for k in range(K):
        v = 0
        if k > 0:
            v += 1
        v += (N - k) // (K - 1)
        if (N - k) % K > 1:
            v += 1
        if v < ans:
            ans = v
    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n, k, q = list(map(int, input().split()))
a = [int(input()) for i in range(q)]
p = [k-q]*n

for i in range(q):
    p[a[i]-1] += 1

print(p)
    
for n in p:
  if n>0:
    print("Yes")
  else:
    print("No")
# Judge status: Accepted
a, b, k = map(int, input().split())

for i in range(k):
    if a + i > b:
        break
    print(a + i)

start = max(a+k, b-k+1)

for i in range(start, b+1):
    print(i)
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))

num_count = [0]*(10**5+1)
tmp_sum = sum(A)
for i in A:
    num_count[i] += 1

for q in range(int(input())):
    B,C = map(int,input().split())
    gain = C*(num_count[B])
    loss = B*(num_count[B])
    num_count[C] += num_count[B]
    num_count[B] = 0
    tmp_sum = tmp_sum + gain - loss
    print(tmp_sum)
# Judge status: Accepted
a, b = map(int, input().split())
print(("Impossible", "Possible")[a % 3 * b % 3 * (a + b) % 3 == 0])
# Judge status: Accepted
N, K = map(int, input().split())
A = list(map(int, input().split()))

ans = int((N-1)/(K-1))

if (N-1)%(K-1) == 0:
    print(ans)
else:
    print(ans+1)
# Judge status: Accepted
n = int(input())
l = list(input())
ans =[0]
for i in range(n):
    if l[i] == "D":
        ans.append(ans[i] - 1)
    else:
        ans.append(ans[i] + 1)
        
print(max(ans))
# Judge status: Accepted
n,m = map(int,input().split())
h = [int(x) for x in input().split()]

mem = [[] for _ in range(n)]

for i in range(m):
    a, b = map(int,input().split())
    mem[a-1].append(b-1)
    mem[b-1].append(a-1)

ans = 0



for j in range(n):
    flag = 1
    for k in range(len(mem[j])):
        if h[j] <= h[mem[j][k]]:
            flag = 0
    if flag ==  1:
        ans += 1

print(ans)
# Judge status: Accepted
s=input()
t=input()
ar1=[0]*26
ar2=[0]*26
for i in s:
    ar1[ord(i)-97]+=1
for i in t:
    ar2[ord(i)-97]+=1
ar1.sort()
ar2.sort()
if ar1==ar2:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
n=int(input())
a=list(input())
c=a.count("W")
b=a[:n-c]
d=b.count("W")
print(d)
print(b)
# Judge status: Accepted
C=[list(input()) for i in range(2)]
if C[0][0]==C[1][2] and C[0][1]==C[1][1] and C[0][2]==C[1][0]:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
with open(0) as f:
    N, *a = map(int, f.read().split())
Set = set()
free = 0
for x in a:
    x //= 400
    if x < 8:
        Set.add(x)
    else:
        free += 1

Ans = [max(1, len(Set)), len(Set)+free]
print(*Ans)
# Judge status: Accepted
X=int(input())
while(1):
    if all(X%i for i in range(2,int(X**0.5)+1)):
        print(X)
        break
    X+=1
# Judge status: Wrong Answer
n = int(input())

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

A = list(sorted(A))

a = A[-1]
b = A[n//2]
# print(a, b)
if n == 2:
    print(a, A[0])
else:
    print(a, A[n//2])
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ab = [0] * N
for i in range(N):
    ab[i] = B[i] - A[i]
m = sum(ab)
ab = sorted(ab, reverse=True)
import math
f, g = 0, 0
for c in ab:
    if c > 0:
        f += math.ceil(c/2)
    elif c < 0:
        g += -c
if max(f, g) <= m:
    result = "Yes"
else:
    result = "No"
print(result)
# Judge status: Wrong Answer
x,y=map(int,input().split())
print(max(max(x,y)*2-1,x*2))
# Judge status: Wrong Answer
bingo = []
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))

N = int(input())

for i in range(N):
    n = int(input())
    if n in a:
        a[a.index(n)] = 0
    elif n in b:
        b[b.index(n)] = 0
    elif n in c:
        c[c.index(n)] = 0

if sum(a) == 0 or sum(b) == 0 or sum(c) == 0 or a[0]+ b[1] + c[2] == 0 or a[2] + b[1] + c[0] == 0:
    print("Yes")
else:print("No")
# Judge status: Accepted
n = int(input())
xy = [list(map(int,input().split())) for _ in range(n)]
from itertools import permutations
count = 0
dist = 0
for l in list(permutations(xy)):
    tmp = 0
    for i in range(len(l)-1):
        tmp += ((l[i+1][0]-l[i][0])**2+(l[i+1][1]-l[i][1])**2)**0.5
    dist += tmp
    count += 1

print(dist/count)
# Judge status: Wrong Answer
import copy

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


while k > 0:
  b = [0 for i in range(n)]
  for i in range(n):
    for j in range(n):
      if j - a[j] - 0.5 < i and i < j + a[j] + 0.5:
        b[i] += 1
  a = copy.copy(b)
  k -= 1
        
for i in range(n):
  print(b[i], ',', end = '')
# Judge status: Wrong Answer
a = int(input())
print(max(j ** i for j in range(32) for i in range(2, 10) if j ** i >= a))
# Judge status: Accepted
N = int(input())
if N<2:
    print(1)
elif N>=2 and  N<4:
    print(2)
elif N >=4 and N<8:
    print(4)
elif N>=8 and N<16:
    print(8)
elif N>=16 and N<32:
    print(16)
elif N>=32 and N<64:
    print(32)
elif N>= 64:
    print(64)
# Judge status: Accepted
N = int(input())
A = [int(a) for a in input().split()]

A.sort(reverse=True)
a = 0
b = 0
i = 1
while i < N:
    if A[i] == A[i-1] and a == 0:
        a = A[i]
        i += 2
    elif A[i] == A[i-1] and b == 0:
        b = A[i]
        i += 2
    else:
        i += 1

print(a*b)
# Judge status: Wrong Answer
N=int(input());result=0
for i in range(N+1):
  if 2**i < N:
    result = 2**i
print(result)
# Judge status: Wrong Answer
# = int(input())
# = map(int, input().split())
# = list(map(int, input().split()))
# = list(input())
# = [tuple(map(int, input().split())) for _ in range(n)]

from fractions import gcd

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

if n == 1:
    print(1)
    exit()

MOD = 10 ** 9 + 7

#def gcd(a, b):
#    while b:
#        a, b = b, a%b
#    return a

c = p[0]
for x in p[1:]:
    c = c * x // gcd(c, x)

ans = 0
for x in p:
    ans += c // x

print(ans)
# Judge status: Accepted
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n = ii()
A = sorted(iil(),reverse=True)[1::2]
print(sum(A[:n]))
# Judge status: Accepted
n = int(input())
b = list(map(int, input().split()))

a = [0] * n
a[0] = b[0]
for i in range(1, n):
    a[i] = b[i-1]
    if a[i - 1] > b[i - 1]:
        a[i - 1] = b[i - 1]

print(sum(a))
# Judge status: Accepted
from itertools import permutations
from math import factorial
def d(a, b):
  x1, y1 = a
  x2, y2 = b
  return ((x1-x2)**2 + (y1-y2)**2)**0.5

cnt = 0
n = int(input())
XY = [list(map(int, input().split())) for _ in range(n)]
for l in permutations(XY):
  for i in range(n-1):
    cnt += d(l[i], l[i+1])
cnt /= factorial(n)
print(cnt)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
temp_list = []
flag = 1

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

for i in range(len(temp_list)):
  if not (temp_list[i] % 3 == 0 or temp_list[i] % 5 == 0):
    flag = 0
    
if flag == 1:
  print('APPROVED')
else:
  print('DENIED')
# Judge status: Accepted
#!/usr/bin/env python3
s = input()
digit = len(s)
if s[1:] == "9"*(digit-1):
    print(int(s[0])+9*(digit-1))
else:
    print(int(s[0])+9*(digit-1)-1)
# Judge status: Accepted
s = input()
t = input()

if len(s) >= 1 and len(s) <= 10 and len(t) == len(s) + 1 and t.startswith(s):
  print("Yes")
else:
  print("No")
# Judge status: Accepted
"""import sys
input = sys.stdin.readline"""
n=int(input())
a=list(map(int,input().split()))
cnt2=0
cnt4=0
for i in a:
    if i%4==0:
        cnt4+=1
    elif i%2==0:
        cnt2+=1
if cnt2>1:
    ans=n-cnt4*2-cnt2
if cnt2<=1:
    ans=n-cnt4*2-1
print("Yes" if ans<=0 else "No")
# Judge status: Accepted
def bikkuri(n):
    if n <= 0:
        return 1
    else:
        return n * bikkuri(n - 1)

nm = input().split(" ")
print(bikkuri(int(nm[0])) // (bikkuri(int(nm[0]) - 2) * 2) * (0 if int(nm[0]) < 2 else 1) + bikkuri(int(nm[1])) // (bikkuri(int(nm[1]) - 2) * 2) * (0 if int(nm[1]) < 2 else 1))
# Judge status: Accepted
n, k = map(int, input().split())

if n % k == 0:
    print(0)
else:
    print(1)
# Judge status: Wrong Answer
s = int(input())

div, mod = divmod(s, 10 ** 9)
ans = [0, 0, 10 ** 9, 1, 0, div]
if mod != 0:
    ans[5:] = [10 ** 9 - mod, div + 1]
print(*ans)
# Judge status: Accepted
x = int(input())
if x < 600:
  print(8)
elif x < 800:
  print(7)
elif x < 1000:
  print(6)
elif x < 1200:
  print(5)
elif x < 1400:
  print(4)
elif x < 1600:
  print(3)
elif x < 1800:
  print(2)
elif x < 2000:
  print(1)
# Judge status: Wrong Answer
x=int(input())

a=x%11
b=x//11
if 0<a<6:
    ans=2*b+1
elif a==0:
    ans=2*b
else:
    ans=2*(b+1)
print(ans)
# Judge status: Wrong Answer
x = int(input())
n = x%100
if x < 100:
    print(0)
    exit()
if n%5:
    if 100*(n//5+1) < x-n:
        print(1)
    else:
        print(0)
else:
    if 100*(n//5) < x-n:
        print(1)
    else:
        print(0)
# Judge status: Accepted
N=int(input())
AB=[tuple(map(int, input().split()))for _ in range(N)]
ans=0
for i in range(N-1,-1,-1):
    a,b=AB[i]
    ans+=b-(a+ans-1)%b-1
print(ans)