Harryxun/stf_run huggingface dataset:
from collections import deque
n, m = map(int, input().split())
a = [0 for _ in range(n)]
b = [0 for _ in range(n)]
Edge = [[] for _ in range(n)]
for i in range(m):
    a[i], b[i] = map(int, input().split())
    a[i] -= 1
    b[i] -= 1
    Edge[a[i]].append(b[i])
    Edge[b[i]].append(a[i])
looked = [1 for i in range(n)]
counter = 0
for i in range(n):
    if looked[i]:
        looked[i] = 0
        counter += 1
        queue = deque([i])
        while queue:
            now = deque.popleft(queue)
            for j in Edge[now]:
                if looked[j]:
                    deque.append(queue, j)
                    looked[j] = 0
print(counter-1)

### FIXED CODE ###

from collections import deque
n, m = map(int, input().split())
Edge = [[] for _ in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    Edge[a].append(b)
    Edge[b].append(a)
looked = [1 for i in range(n)]
counter = 0
for i in range(n):
    if looked[i]:
        looked[i] = 0
        counter += 1
        queue = deque([i])
        while queue:
            now = deque.popleft(queue)
            for j in Edge[now]:
                if looked[j]:
                    deque.append(queue, j)
                    looked[j] = 0
print(counter-1)
import sys

array = ""
for line in sys.stdin:
    array += line

char = ["" for _ in range(len(array))]
for i in range(len(array)):
    char[i] = array[i:i+1]

count = [0 for _ in range(26)]
for c in char:
    for i in range(26):
        if c == chr(i+ord("A")) or c == chr(i+ord("a")):
            count[i] += 1

for i in range(26):
    print("{0} : {1}".format(chr(i+ord("a")), alp[i]))

### FIXED CODE ###

import sys

count = [0 for _ in range(26)]

for line in sys.stdin:
    array = line
    char = ["" for _ in range(len(array))]
    for i in range(len(array)):
        char[i] = array[i:i+1]
    for c in char:
        for i in range(26):
            if c == chr(i+ord("A")) or c == chr(i+ord("a")):
                count[i] += 1


for i in range(26):
    print("{0} : {1}".format(chr(i+ord("a")), count[i]))
N,M = map(int,input().split())
A = [list(map(int,input.split())) for _ in range(N)]

like = [0] * M

for i in range(N):
    for j in range(A[i][0]):
        like[A[i][j+1]] += 1
        
cnt = 0
for i in range(M):
    if like[i] == M:
        cnt += 1

print(cnt)

### FIXED CODE ###

N,M = map(int,input().split())
A = [list(map(int,input().split())) for _ in range(N)]
like = [0] * M

for i in range(N):
    for j in range(A[i][0]):
        like[A[i][j+1]-1] += 1
        
cnt = 0
for i in range(M):
    if like[i] == N:
        cnt += 1

print(cnt)
n=int(input())
t=1
import math
for i in range(n):
  j=int(input())
  t=t*j//math.gcd(t,j)
print(t)

    

### FIXED CODE ###

n=int(input())
t=1
import fractions
for i in range(n):
  j=int(input())
  t=t*j//fractions.gcd(t,j)
print(t)
import sys
import math
from  collections import defaultdict

# sys.stdin = open('input.txt', 'r')
# sys.stdout = open('output.txt', 'w')

def solve(test):
	s = input()
	t = input()
	memo = {}
	ans = lcs(s, t, 0, 0, memo)
	print(ans)

def lcs(s, t, i, j, memo):
	if (i, j) in memo:
		return memo[(i, j)]
	elif i == len(s) or j == len(t):
		return ''
	else:
		ans = ''
		if s[i] == t[j]:
			ans = s[i] + lcs(s, t, i + 1, j + 1, memo)
		else:
			s1 = lcs(s, t, i + 1, j, memo)
			s2 = lcs(s, t, i, j + 1, memo)
			if len(s1) >= len(s2):
				ans = s1
			else:
				ans = s2
		memo[(i, j)] = ans
		return ans


if __name__ == "__main__":
	test_cases = 1
	for t in range(1, test_cases + 1):
		solve(t)


### FIXED CODE ###

import sys
import math
from  collections import defaultdict

# sys.stdin = open('input.txt', 'r')
# sys.stdout = open('output.txt', 'w')


def solve(test):
	s = [''] + list(input())
	t = [''] + list(input())
	rec = [[0 for j in range(len(t))] for i in range(len(s))]
	for i in range(1, len(s)):
		for j in range(1, len(t)):
			if s[i] == t[j]:
				rec[i][j] = 1 + rec[i - 1][j - 1]
			else:
				rec[i][j] = max(rec[i - 1][j], rec[i][j - 1])

	ans = []
	i, j = len(s) - 1, len(t) - 1
	while i >= 0 and j >= 0:
		if s[i] == t[j]:
			ans.append(s[i])
			i -= 1
			j -= 1
		elif rec[i - 1][j] > rec[i][j - 1]:
			i -= 1
		else:
			j -= 1

	print(''.join(ans[::-1]))


if __name__ == "__main__":
	test_cases = 1
	for t in range(1, test_cases + 1):
		solve(t)
while True:
	d = int(input())
	ans = 0
	x = d
	while x < 600:
		ans += (x**2)*dx += d


### FIXED CODE ###

while True:
	try: d = int(input())
	except: break
	print(sum([(i*d)**2*d for i in range(600//d)]))
N=input()
if N%10==3:
    print('bon')
elif N%10==0 or  N%10==1 or  N%10==6 or  N%10==8:
    print('pon')
else:
    print('hon')


### FIXED CODE ###

N=int(input())
if N%10==3:
    print('bon')
elif N%10==0 or  N%10==1 or  N%10==6 or  N%10==8:
    print('pon')
else:
    print('hon')
A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
B = [int(input()) for _ in range(N)]

key = []
for i, v in enumerate(A):
    for k, j in enumerate(v):
        if (j in B):
            key.append([i, k])

ans = [[[0, 0], [1, 0], [2, 0]], [[0, 1], [1, 1], [2, 1]], [[0, 2], [1, 2], [2, 2]], [[0, 0], [1, 1], [2, 2]], [
    [0, 2], [1, 1], [2, 0]], [[0, 0], [0, 1], [0, 2]], [[1, 0], [1, 1], [1, 2]], [[2, 0], [2, 1], [2, 2]]]

for i in ans:
    for j in i:
        if (j in key.sort()):
            print('Yes')
            exit()

print('No')


### FIXED CODE ###

A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
B = [int(input()) for _ in range(N)]

key = []
for i, v in enumerate(A):
    for k, j in enumerate(v):
        if (j in B):
            key.append([i, k])

ans = [[[0, 0], [1, 0], [2, 0]], [[0, 1], [1, 1], [2, 1]], [[0, 2], [1, 2], [2, 2]], [[0, 0], [1, 1], [2, 2]], [
    [0, 2], [1, 1], [2, 0]], [[0, 0], [0, 1], [0, 2]], [[1, 0], [1, 1], [1, 2]], [[2, 0], [2, 1], [2, 2]]]

for i in ans:
    count = 0
    for j in i:
        if (j in key):
            count += 1
    if (count == 3):
        print('Yes')
        exit()

print('No')
S = list(input())
T = list(input())
pos = []
for i in range(len(S)):
    if S[i] == T[0]:
        flag = 1
        for j in range(len(T)):
            if not T[j] == S[i+j] and not S[i+j] == '?':
                flag = 0
                break
        if flag:
            pos.append(i)

if not pos:
    print('UNRESTORABLE')
    exit()

words = []
for p in pos:
    word = S[0:p] + T + S[p+len(T):]
    for i in range(len(word)):
        if word[i] == '?':
            word[i] = 'a'
    words.append(word)
words.sort()
print("".join(words[0]))


### FIXED CODE ###

S = input()
T = input()
def checkstr(ss):
    for (s,t) in zip(ss,T):
        check = True
        if s=="?":
            continue
        elif s!=t:
            check = False
            break
    return check
ans = ""
for i in range(len(S)-len(T)+1):
    strs = S[i:i+len(T)]
    if checkstr(strs):
        ans = S[:i].replace("?","a")+T+S[i+len(T):].replace("?","a")
if ans=="":
    print("UNRESTORABLE")
else:
    print(ans)
n = int(input())
k = int((n*2)**.5)
while k*(k+1)//2 < n:
  k += 1
l = [range(1,k+1)]
if k*(k+1)//2-n:
  l.remove(k*(k+1)//2-n)
for i in l:
  print(l)

### FIXED CODE ###

n = int(input())
k = int((n*2)**.5)
while k*(k+1)//2 < n:
  k += 1
l = list(range(1,k+1))
if k*(k+1)//2-n:
  l.remove(k*(k+1)//2-n)
for i in l:
  print(i)
n = int(input())
total = for i in range(n):
    total += i

print(total)

### FIXED CODE ###

n = int(input())
total = n
for i in range(n):
    total += i

print(total)
N = int(input())
mod = int(1e9+7)
for j in range(1, N+1):
    prod = j * (prod%mod)
print(prod)

### FIXED CODE ###

import math
print(math.factorial(int(input()))%int(1e9+7))
K = int(input())
k = K
A,B = map(int, input().split())
for i in range(1, B+1):
    k *= i
    if k > a and k < b:
        print('OK')
        a = True
        break
if not a:
    print('NG')


### FIXED CODE ###

t_have = 100
t_need_achieve = int(input())
count_year = 0
while t_have < t_need_achieve:
    t_have += t_have // 100
    count_year += 1
print(count_year)
cols = map( int, input().split() )
cols set = set( cols )

print( len( cols set ) )

### FIXED CODE ###

cols = set( map( int, input().split() ) )
 
print( len( cols ) )
N = int(input())
lis = []
[lis.append(input()) for i in range(N)]
 
tmp_dic = {}
for s in lis:
    if s not in tmp_dic:
        tmp_dic[s] = 1
    else:
        tmp_dic[s] += 1
        
max_count = 0
for k,v in tmp_dic.items():
    max_count = max(v,max_count)
    
ans_lis = []
for k,v in tmp_dic.items():
    if v == max_count:
        ans_lis.append(k)
        
ans_lis.sort()
[print(f"{s}") for s in ans_lis]

### FIXED CODE ###

import collections

N = int(input())
cnt_dic = collections.defaultdict(int)

for _ in range(N):
  s = input()
  cnt_dic[s] += 1

max_v = max(cnt_dic.values())

ans_lis = [k for k, v in cnt_dic.items() if v == max_v]

for s in sorted(ans_lis):
  print(s)
N,M=map(int,input().split())
A=list(map(int,input().split()))

homework=0

for a in A:
    homework+=a

if N>hemework:
    print(N-homework)
else:
    print(-1)

### FIXED CODE ###

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

homework=0

for a in A:
    homework+=a

if N>=homework:
    print(N-homework)
else:
    print(-1)
t = int(input)
print("Yes" if t >= 30 else "No")

### FIXED CODE ###

t = int(input())
print("Yes" if t >= 30 else "No")
K = int(input(), 10)
S = input().lower()

if 0 < K < 101 and 0 < len(S) < 101:
    if len(S) < K:
        print(S)
    else:
        print(S[:K] + "...") 
else:
    print("Try again with K and length of S between 1 and 100")


### FIXED CODE ###

N = int(input())

if N < 1000:
    num = str(N)
    if num[-1] == "3":
        print("bon")
    elif num[-1] in ["0", "1", "6", "8"]:
        print("pon")
    else:
        print("hon")
else:
    print("Please enter an interger between not exceeding 999")
print a*b

### FIXED CODE ###

n=raw_input()
k=n.split(" ")
a=int(k[0])
b=int(k[1])
print a*b ,
print (a+b)*2
n,k = map(int, input().split())
d = []
c = []
e = []
for i in range(k):
    d.append(int(input()))
    a = input()
    c.append([a[j:j+1] for j in range(len(a))])
    e[i] = list(map(int, c[i]))

for j in range(k):
    for k in range(d[j]):
        a = set(e[j][k])

print(n-len(a))

### FIXED CODE ###

n,k = map(int, input().split())
d = []
A= []
c = []
 
for i in range(k):
    d.append(int(input()))
    A.append(list(map(int, input().split())))
 
for j in range(k):
    for m in range(d[j]):
        c.append(A[j][m])
 
print(n-len(set(c)))
x=int(input())
a=x // 500
y=x-500a
b= y // 5
happy = a*1000+b*5
print(happy)

### FIXED CODE ###

x=int(input())
a =x // 500
y = x-500*a
b = y // 5
happy = a*1000+b*5
print(happy)
xN=int(input())
H=[int(x) for x in input().split()]
cur=[0]*N
for i in range(N):
    if H[i]<=H[i-1]:
        cur[i]=cur[i-1]+1
print(max(cur))


### FIXED CODE ###

N=int(input())
H=[int(x) for x in input().split()]
ans=0
cur=0
for i,h in enumerate(H):
    if i>=1 and h<=H[i-1]:
        cur=cur+1
        ans=max(ans,cur)
    else:
        cur=0
print(ans)
N=int(input())
ans=[]
for i in range(1,int(N**.5)):
    if N%i==0:
        ans.append(N//i+i-2)
print(min(ans))

### FIXED CODE ###

N=int(input())
ans=[]
for i in range(1,int(N**.5)+2):
    if N%i<1:
        ans.append(N//i+i-2)
print(min(ans))
n = input()
x = n//1000
print(n-x*1000)


### FIXED CODE ###

n = int(input())
if(n%1000==0):
    print(0)
else:
    x = n//1000
    print((x+1)*1000-n)
n = int(input())
nums = list(map(int, input()))
ans = []
for i in range(n):
    for j in range(i+1,n):
        ans.append(nums[i] * nums[j])
print(sum(ans))

### FIXED CODE ###

n = int(input())
nums = list(map(int, input().split()))
ans = []
for i in range(n):
    for j in range(i+1,n):
        ans.append(nums[i] * nums[j])
print(sum(ans))
s = input()
t = 'keyence'

count = 0
count2 = 0
flag = True

for i in s:
    if i == t[count]:
        count += 1
        flag = True
    else:
        if flag:
            count2 += 1
            flag = False
        else:
            pass

if count2 <= 1 and count == len(t):
    print('YES')
else:
    print('NO')


### FIXED CODE ###

s = input()
t = 'keyence'

idx = 0
for i in range(len(s)):
    if i < len(t):
        if s[i] != t[i]:
            idx = i
            break
    elif i == len(t):
        print('YES')
        exit()

for i in range(idx,len(s)):
    if s[:idx] + s[i:] == t:
        print('YES')
        exit()

print('NO')
o = input()
e = input()
ans = []
for i in range(len(o)):
  ans.append(o[i])
  if i < len(o) or len(e) == len(o) 
    ans.append(e[i])
print("".join(ans))

### FIXED CODE ###

o = input()
e = input()
ans = []
for i in range(len(o)):
  ans.append(o[i])
  if i < len(o) - 1 or len(e) == len(o):
    ans.append(e[i])
print("".join(ans))
import sys
from itertools import accumulate

def main():
	input = sys.stdin.readline
	n = int(input())
	d = [list(accumulate(map(int, input().split()))) + [0] for _ in range(n)] + [[0] * (n + 1)]
	for j in range(n):
		for i in range(n - 1):
			d[i + 1][j] += d[i][j]

	def divisors(x):
		ret = []
		for i in range(1, x + 1):
			if i > n:break
			if x % i == 0 and x // i <= n:
				ret += [(i - 1, x // i - 1)]
		return ret

	ref = [0 if not divisors(z) else max(d[i + y][j + x] - d[i - 1][j + x] - d[i + y][j - 1] + d[i - 1][j - 1] for x, y in divisors(z) for i in range(n - y) for j in range(n - x)) for z in range(n * n + 1)]
	ref = list(accumulate(ref, max))
	print("\n".join(map(str, [ref[int(input())] for _ in range(int(input()))])))

if __name__ == "__main__":
	main()


### FIXED CODE ###

import sys
input = sys.stdin.buffer.readline

def f(g: list, deg: list):
	l = len(g)
	depth = [0] * l
	ret = []
	q = []
	for i, d in enumerate(deg):
		if not d:
			ret.append(i)
			q.append(i)
	while q:
		cur = q.pop(0)
		for nxt in g[cur]:
			deg[nxt] -= 1
			if not deg[nxt]:
				depth[nxt] = depth[cur] + 1
				ret.append(nxt)
				q.append(nxt)
	if l > len(ret):
		return False
	return max(depth)

def label(a, b, n):
	if a > b:
		a, b = b, a
	return (a - 1) * (2 * n - a) // 2 + b - a - 1


def main():
	n = int(input())
	g = [[] for _ in range(n * (n - 1) // 2)]
	deg = [0] * (n * (n - 1) // 2)
	for i in range(1, n + 1):
		l = list(map(int, input().split()))
		for x, y in zip(l, l[1:]):
			t = label(i, y, n)
			g[label(i, x, n)].append(t)
			deg[t] += 1
	depth = f(g, deg)
	if not depth:
		print(-1)
		exit()
	print(depth + 1)

if __name__ == "__main__":
	main()
a, b = map(int, input().split())
rint(b)
answer = a * b
print(answer)


### FIXED CODE ###

#169A https://atcoder.jp/contests/abc169/tasks/abc169_a
# 1. 入力を受け取ること
# スペース区切りの入力を整数として受け取れる「2 5」　→　「a=2, b=5」となる
a, b = map(int, input().split())

# 2. 受け取った結果を使って目的の計算をすること
answer = a * b

# 3. 出力すること
print(answer)
n = int(input())
apple = eval(input().replace(" ", "*"))
print(apple if apple <= 10**18 else -1)

### FIXED CODE ###

n = int(input())
apple = list(map(int, input().split()))
if 0 in apple:
    print(0)
else:
    cat = 1
    for i in apple:
        cat *= i
        if cat > 10**18:
            break
        else:
            pass
    print(cat if cat <= 10**18 else -1)
N = int(input())
L = [2,1]
if N > 3:
    for i in range(2,N+1):
        L.append(L[i-1]+L[i-2])
print(L[N])

### FIXED CODE ###

N = int(input())
L = [2,1]
if N > 1:
    for i in range(2,N+1):
        L.append(L[i-1]+L[i-2])
print(L[N])
s = [int(input()) for i in range(3)]
s = list(set(s))
print(len(s))

### FIXED CODE ###

s = list(map(int, input().split()))
s = list(set(s))
print(len(s))
K=int(input())
S=list(input())

if len(S) < K:
    print(S)
else:
    print(S[0:(SL-1):1],"...")


### FIXED CODE ###

K=int(input())
S=input()
s=list(S)

if len(s) <= K:
    print(S)
else:
    print(S[0:K:]+"...")
N,A,B,C = map(int,input().split())
data = {
  "A":A,
  "B":B,
  "C":C
}
select = []
S = list(input() for _ in range(N))
for i in range(N):
  s = S[i]
  if data[s[0]] == data[s[1]] ==0:
    print("No")
    exit(0)
  elif data[s[0]] > data[s[1]]:
    data[s[0]] -= 1
    data[s[1]] += 1
    select.append(s[1])
  elif data[s[0]] < data[s[1]]:
    data[s[0]] += 1
    data[s[1]] -= 1
    select.append(s[0])
  else:
    ss = S[i+1]
  if i == N - 2:
    select.append(s[0])
  elif s[0] in ss:
    data[s[0]] += 1
    data[s[1]] -= 1
    select.append(s[0])
  else:
    data[s[0]] -= 1
    data[s[1]] += 1
    select.append(s[1])

print("Yes")
for i in select:
  print(i)

### FIXED CODE ###

N,A,B,C = map(int,input().split())
data = {
  "A":A,
  "B":B,
  "C":C
}
select = []
S = list(input() for _ in range(N))
for i in range(N):
  s = S[i]
  if data[s[0]] == data[s[1]] ==0:
    print("No")
    exit(0)
  elif data[s[0]] > data[s[1]]:
    data[s[0]] -= 1
    data[s[1]] += 1
    select.append(s[1])
  elif data[s[0]] < data[s[1]]:
    data[s[0]] += 1
    data[s[1]] -= 1
    select.append(s[0])
  elif i == N-1:
    select.append(s[0])
  elif s[0] in S[i+1]:
    data[s[0]] += 1
    data[s[1]] -= 1
    select.append(s[0])
  else:
    data[s[0]] -= 1
    data[s[1]] += 1
    select.append(s[1])
print("Yes")
for i in select:
  print(i)
s = input()
na = 0
nb = 0
nc = 0
for c in s:
  if c == 'a': na += 1
  if c == 'b': nb += 1
  if c == 'c': nc += 1

if a == b == c:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

s = input()
na = 0
nb = 0
nc = 0

for c in s:
  if c == 'a': na += 1
  if c == 'b': nb += 1
  if c == 'c': nc += 1

if na == nb == nc:
  print('Yes')
else:
  print('No')
L, R = map(int,input().split())

mod = 2019
for i in range(500):
  if L <= (3**i)%(1e9+7) <= R or L <= (673**i)%(1e9+7) <= R or L <= (3*673*i)%(1e9+7) <= R or L <= (3*i)%(1e9+7) <= R or L <= (673*i)%(1e9+7) <= R:
    print(0)
    exit()
else:
  print(min((L*(L+1))%mod, R*(R-1)%mod, R*L%mod))

### FIXED CODE ###

L, R = map(int,input().split())

R = min(R, L+673)
ans = 2018
for i in range(L, R+1):
  for j in range(i+1, R+1):
    ans = min(ans, i*j%2019)
print(ans)
from math import floor

def divisor(n):
    left = []
    right = [n]
    sup = floor(pow(n,1/2))
    for p in range(2,sup+1):
        if n % p == 0:
            left.append(p)
            right.append(n//p)
    res = left + right[::-1]
    return res
        
N = int(input())

div = divisor(N)
ans = 0

for d in div:
    if N // (d-1) == N % (d-1):
        ans += (d-1)

print(ans)

### FIXED CODE ###

from math import floor

N = int(input())
ans = 0
sup = floor(pow(N,1/2))
for r in range(1,sup+1):
    if N % r == 0:
        m = N // r - 1
        if 0 <= r <= m-1:
            ans += m
print(ans)
import numpy as np
import networkx as nx

H, W = [int(a) for a in input().split()]
ss = []
for _ in range(H):
    ss.append(input())

ss = np.array(ss)

g = nx.Graph()
g.add_nodes_from([("%d_%d" % (i,j), {'color':ss[i][j]}) for i in range(H) for j in range(W)])
g.add_edges_from([("%d_%d" % (i,j), "%d_%d" % (i,j+1), {'weight':1}) for i in range(H) for j in range(W-1)])
g.add_edges_from([("%d_%d" % (i,j), "%d_%d" % (i+1,j), {'weight':1}) for i in range(H-1) for j in range(W)])

#print(g.nodes(data=True))
#print(g.edges(data=True))


if nx.algorithms.shortest_paths.generic.has_path(g, source="0_0", target="%d_%d" % (H-1,W-1)) == False:
    print(-1)
else:
    path = nx.algorithms.shortest_paths.generic.shortest_path(g, source="0_0", target="%d_%d" % (H-1,W-1), weight='weight')
    ss_ = "".join(ss)
    num = len([0 for c in ss_ if c == '.'])
    #print(num)
    #print(path)
    print(num - len(path))




### FIXED CODE ###

import numpy as np
import scipy as sp
import scipy.sparse.csgraph as sg

H, W = [int(a) for a in input().split()]
ss = []
for _ in range(H):
    ss.append(input())

g = np.zeros((H*W,H*W))

v_edges = [((i,j), (i,j+1)) for i in range(H) for j in range(W-1) if ss[i][j] == "." and ss[i][j+1] == "."]
h_edges = [((i,j), (i+1,j)) for i in range(H-1) for j in range(W) if ss[i][j] == "." and ss[i+1][j] == "."]

for (si,sj), (di,dj) in v_edges + h_edges:
    g[si*W+sj][di*W+dj] = 1
    g[di*W+dj][si*W+sj] = 1

r = sg.dijkstra(g, indices=[0,H*W-1])
score = r[0,H*W-1]

if sp.isinf(score):
    print(-1)
    exit(0)
else:
    #print(r)
    #print(ss) 

    ss_ = "".join(ss)
    num = len([0 for c in ss_ if c == '.'])
    #print(num)
    #print(score)
    print("%d" % (num - (score+1)))
=int(input())
l=10**9+7
nums=list(map(int,input().split()))
k=len(str(bin(max(nums))))-2
mat=[]
for each in nums:
    num=str(bin(each))[2:].zfill(k)
    mat.append(list(num))

mat=list(zip(*mat))
ans=0

for i in range(k):
    b=mat[i].count("1")
    
    ans+=b*(N-b)*(2**(k-i-1))
print(ans)

### FIXED CODE ###

mod=10**9+7
N=int(input())
str_a = ''.join(['{:060b}'.format(a) for a in map(int, input().split())])

ans=0
for i in range(60):
    ones=str_a[59-i::60].count("1")
    ans+= pow( 2, i ,mod)* ones *(N-ones)
print(ans%mod)
n,k=map(int,input().split())
X=[int(i) for i in input().split()]+[0]
X.sort()
sn=X.index(0)
print(X)
road=[]
for j in range(sn):
    if X[j+k]>0:
        road.append(abs(X[j]-0)+abs(X[j+k]-X[j]))
    else:
        road.append(abs(X[j]-0)+abs(X[j+k-1]-X[j]))

for j in range(sn+1,n-k+1):
    road.append(abs(X[j]-0)+abs(X[j+k-1]-X[j]))

if len(road)>0:
    print(min(road))
else:
    print(0)

### FIXED CODE ###

n,k=map(int,input().split())
X=[int(i) for i in input().split()]
road=[]
for i in range(n-k+1):
    if X[i]<=0 and X[i+k-1]>=0:
        r=min(abs(X[i]),X[i+k-1])+X[i+k-1]-X[i]
    elif X[i]<=0 and X[i+k-1]<=0:
        r=abs(X[i])
    else:
        r=X[i+k-1]
    road.append(r)

print(min(road))
from collections import deque

S = input()
Q = int(input())
q = deque([S])
reverse = -1

for i in range(Q):
    print(reverse)
    X = input().split()
    if X[0] == "1":
        reverse *= -1
    # if X[1] == "1":
    elif X[1] == "1":
        if reverse == -1:
            q.appendleft(X[2])
        else:
            q.append(X[2])
    elif X[1] == "2":
        if reverse == -1:
            q.append(X[2])
        else:
            q.appendleft(X[2])
    print(reverse, q)
if reverse == 1: q.reverse()

for i in range(len(q)):
    print(q[i],end="")
print()
        


### FIXED CODE ###

from collections import deque

q = deque(input())
Q = int(input())
reverse = -1

for i in range(Q):
    X = input().split()
    if X[0] == "1":
        reverse *= -1
    # if X[1] == "1":
    elif X[1] == "1":
        if reverse == -1:
            q.appendleft(X[2])
        else:
            q.append(X[2])
    elif X[1] == "2":
        if reverse == -1:
            q.append(X[2])
        else:
            q.appendleft(X[2])
# if reverse == 1: q.reverse()

if reverse == -1:
    print(''.join(q))
else:
    print(''.join(list(q)[::-1]))
def how_many_times_divisible(n):
	ans = 0
	while n % 2 == 0:
		n /= 2
		ans += 1
	return ans
 
n = int(raw_input())
a = map(int, raw_input().split())
ans = min(map(how_many_times_divisible(a)))
 
print ans

### FIXED CODE ###

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


count1 = 0
k = 0
while True:
  count2 = 0
  for i in range(N):
      if A[i]/2** k % 2 !=0:
        break
      else:
        count2 += 1
  if count2 == N:
    count1 += 1
  else:
    break
  k += 1

print(count1)