Harryxun/stf_run huggingface dataset:
# input 
n = map(int, input())
a = map(int, input().split(" "))

# make list 
curlist = list(a)

# du recurse
def sunukeList(curlist, cnt) :
    print("DBG : ", curlist)
    reslist = []
    flg_div2 = 0
    flg_did3 = 0

    for i in curlist :    
        # if divisible by two then divide
        if i%2 == 0 and flg_div2 == 0: 
            reslist.append(int(i/2))
            flg_div2 = 1
        else :
            reslist.append(i*3)
            flg_did3 = 1

    if flg_div2 == 0 :
        print(cnt)
    else :
        sunukeList(reslist, cnt + 1)
        
# calc
sunukeList(curlist, 0)


### FIXED CODE ###

n = map(int, input())
alist = list(map(int, input().split(" ")))

def two_factor(n) :
    cnt = 0

    while n % 2 == 0:
        n /= 2
        cnt += 1

    return cnt 
    
fact_cnt = 0
for a in alist :
    fact_cnt += two_factor(a)
    
print(fact_cnt)
a, b = input().split()
num = int(a+b)

for i in range(1, 101):
  if num == i*i:
    print('Yes')
    return
    
print('No')

### FIXED CODE ###

a, b = input().split()
num = int(a+b)

heihou = False

for i in range(1, 1000):
  if num == i*i:
    heihou = True
    break

if heihou:
  print('Yes')
else:
  print('No')
N=int(intput())
if N<1000:
    print("ABC")
else :
    print("ABD")

### FIXED CODE ###

N=int(input())
if N<1000:
    print("ABC")
else :
    print("ABD")
K = int(input())
S = input()
sth = S.split(S[K])
print(sth[0]+"...")

### FIXED CODE ###

K = int(input())
S = input()
if int(len(S)) <= K:
  print(S)
else:
  for i in range(len(S)):
    if i < K:
      print(S[i],end="")
    else:
      print("...")
      break
def main():
    a = []
    for i in range(2):
        a.append(int(input()))
    print(str(a[0] * a[1]) + " " + str(2 * (a[0] + a[1])))

if __name__ == "__main__":
    main()


### FIXED CODE ###

def numinput():
    a = input().split()
    for i in range(len(a)):
        a[i] = int(a[i])
    return a

def main():
    a = numinput()
    print('%d %d' % (a[0] * a[1], 2 * (a[0] + a[1])))

if __name__ == "__main__":
    main()
import sys
from itertools import permutations

def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
            return None

def solve():
    N = int(input())
    assert N <= 8

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

    cnt = 0
    MOD = 10**9 + 7

    for pm in permutations(range(N)):
        Xc = X[:]
        flag = True

        for p in pm:
            for i in range(p-1, 0, -1):
                if Xc[i] < 2*i + 1:
                    flag = False
                    break
            if flag:
                break
            Xc[p] = float('inf')
            k += 1

        cnt += flag

    print(cnt % MOD)


if __name__ == '__main__':
    solve()

### FIXED CODE ###

import sys
from math import factorial

def debug(x, table):
    for name, val in table.items():
        if x is val:
            print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
            return None

def solve():
    N = int(input())
    X = [int(i) for i in input().split()]
    MOD = 10**9 + 7
    ans = 1
    stack = 0

    for x in X:
        stack += 1
        if x < 2*(stack - 1) + 1:
            ans *= stack
            ans %= MOD
            stack -= 1

    ans *= (factorial(stack) % MOD)
    ans %= MOD

    print(ans)


if __name__ == '__main__':
    solve()
n = int(input())
arr = []
passed = []
for i in range(n):
  a = int(input())
  arr.append(a)
  
next_position = 1
ans = 0

while(1):
  next_position = arr[next_position-1]
  #print(position)
  if ans == n
    print(-1)
    break
  #passed.append(next_position)
  ans += 1
  if next_position == 2:
    print(ans)
    break
  

### FIXED CODE ###

n = int(input())
arr = []
passed = []
for i in range(n):
  a = int(input())
  arr.append(a)
  
next_position = 1
ans = 0

while(1):
  next_position = arr[next_position-1]
  #print(position)
  if ans == n:
    print(-1)
    break
  #passed.append(next_position)
  ans += 1
  if next_position == 2:
    print(ans)
    break
n = int(input())
a = int(input())
b = int(input())

print("".format(min(n*a, b)))

### FIXED CODE ###

n, a, b = input().split()
n = int(n)
a = int(a)
b = int(b)
print("{}".format(min(n*a, b)))
S = list(input())
T = list(input())
l = 0
for s in range(len(S)-len(T)+1):
    if S[s]=="?" or S[s] == T[0]:
        k = 0
        for t in range(len(T)):
            if S[s+t]!="?" and S[s+t]!=T[t]:
                break
            else:
                k+=1
    if k==len(T):
        l = s
        break
if k<len(T):
    print("UNRESTORABLE")
else:
    ans = []
    for i in range(len(S)):
        if l <= i and i < i+k:
            ans.append(T[i-l])
        elif S[i]=="?":
            ans.append("a")
        else:
            ans.append(S[i])
    print("".join(ans))

### FIXED CODE ###

S = list(input())
T = list(input())
if len(S)<len(T):
    print("UNRESTORABLE")
else:
    S = S[::-1]
    T = T[::-1]
    k = 0
    l = 0
    for i in range(len(S)-len(T)+1):
        if S[i]=="?" or S[i]==T[0]:
            k = 0
            for j in range(len(T)):
                if S[i+j]=="?" or S[i+j]==T[j]:
                    k+=1
        if k==len(T):
            l = i
            break
    if k!=len(T):
        print("UNRESTORABLE")
    else:
        ans = []
        for i in range(len(S)):
            if l <= i and i < l+k:
                ans.append(T[i-l])
            elif S[i]=="?":
                ans.append("a")
            else:
                ans.append(S[i])
        print("".join(ans[::-1]))
1 SW = list(map(int,input().split()))
SW = list(map(int,input().split()))
if (SW[0] > SW[1]):
  print("safe")
else:
  print("unsafe")

### FIXED CODE ###

SW = list(map(int,input().split()))
if (SW[0] > SW[1]):
  print("safe")
else:
  print("unsafe")
a,b,c=map(int,input().split())
d=a-b
e=c-d
if >=0:
  print(e)
else:
  print(0)
    


### FIXED CODE ###

a,b,c=map(int,input().split())
d=a-b
e=c-d
if e>=0:
  print(e)
else:
  print(0)
x = list(input())
for i in range(len(x)):
  if x[i] = 0:
    print(x[i])
    break

### FIXED CODE ###

x = list(map(int,input().split()))
for i in range(len(x)):
  if x[i] == 0:
    print(i+1)
    break
import re
text = input()
b_length = int(re.sub('[^B]', '', text))
for _ in range(b_length):
    text = re.sub('(0|1)??B', '', text, 1)
print(text)

### FIXED CODE ###

import re
text = input()
b_length = len(re.sub('[^B]', '', text))
for _ in range(b_length):
    text = re.sub('(0|1)??B', '', text, 1)
print(text)
N = int(input())
x = [int(input()) for _ in range(N)]
print(len(x) + (N // min(x)))


### FIXED CODE ###

N, *x = map(int, open(0))
print(4 - (-N // min(x)))
O = input()
N = input()

pw = ""
if len(O) = len(N):
	for i in range(len(O)):
    	pw += O[i] + N[i]
else:
	for i in range(len(O)-1):
    	pw += O[i] + N[i]
    pw += O[-1]
   
print(pw)

### FIXED CODE ###

O = input()
N = input()

pw = ""
if len(O) == len(N):
    for i in range(len(O)):
        pw += O[i] + N[i]
else:
    for i in range(len(O)-1):
        pw += O[i] + N[i]
    pw += O[-1]
   
print(pw)
x,k,d=map(int,input().split())
o =x//d
if x <0 and x-(1*d*0)+(1*d*(k-0)) <=0:
    print(x-(1*d*0)+(1*d*(k-0)))
    exit()
else:
    print(min(x+(1*d*o,x+(1*d*(o+1),x+(1*d*(o-1)))
    exit()
    
if x >0 and x-(1*d*k)+(1*d*(0)) >=0:
    print(x-(1*d*k)+(1*d*(0)))
    exit()
else:
   print( min(x-(1*d*o,x-(1*d*(o+1),x-(1*d*(o-1)))
   exit()


### FIXED CODE ###

x,k,d=map(int,input().split())
x =abs(x)
o =x//d
if (x-d*k) >=0:
    print(x-d*k)
    exit()
else:
    if (k-o)%2==0:
        print(abs(x%d))
        exit()
    else:
        print(abs(x%d-d))
        exit()
n = int(input())
if n == 3 or n == 5 or n == 7:
  print(YES)
else:
  print(NO)

### FIXED CODE ###

n = int(input())
if n == 3 or n == 5 or n == 7:
  print("YES")
else:
  print("NO")
N = int(input())
A = list(map(int, input().split()))

A.sort()
i = 0
res = 0
if N % 2 == 1:
  res = 1
  i = 1
  if A[0] == A[1]:
    print(0)
    exit(0)
  if A[0] == 1:
    print(0)
    exit(0)
else:
  res = 2
  i = 2
  if A[0] != A[1]:
    print(0)
    exit(0)
  if A[0] == 0:
    print(0)
    exit(0)
while i < N - 1:
  if A[i] == A[i + 1]:
    if N % 2 == 0:
      if A[i] != 2 * (i / 2 + 1) - 1:
        res = 0
        break
    else:
      if A[i] != 2 * (i // 2 + 1):
        res = 0
        break
    res *= 2
    i += 2
  else:
    res = 0
    break
print(res)



### FIXED CODE ###

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

A.sort()
mod = 10 ** 9 + 7
i = 0
res = 0
if N == 1:
  if A[0] == 0:
    print(1)
  else:
    print(0)
  exit(0)
if N % 2 == 1:
  res = 1
  i = 1
  if A[0] == A[1]:
    print(0)
    exit(0)
  if A[0] == 1:
    print(0)
    exit(0)
else:
  res = 2
  i = 2
  if A[0] != A[1]:
    print(0)
    exit(0)
  if A[0] == 0:
    print(0)
    exit(0)
while i < N - 1:
  if A[i] == A[i + 1]:
    if N % 2 == 0:
      if A[i] != 2 * (i / 2 + 1) - 1:
        res = 0
        break
    else:
      if A[i] != 2 * (i // 2 + 1):
        res = 0
        break
    res *= 2
    i += 2
  else:
    res = 0
    break
print(res % mod)
a,b = input().split()
num = int(a+b)
import math
root = math.sqrrt(num)
if root%1==0:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

a,b = input().split()
num = int(a+b)
import math
root = math.sqrt(num)
if root%1==0:
  print('Yes')
else:
  print('No')
N=int(input())

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

b=[]
for i in range(N):
    b.append(a[i].pop(0))

an=0

while True:
    note=[]
    x=0
    for i in range(N):
        if b[i]!=N and b[b[i]]==i:
            x=1
            note.append(i)
    for i in note:
        try:
            b[i]=a[i].pop(0)
        except:
            b[i]=N
    if x==1:
        an+=1
    elif b==[N for i in range(N)]:
        print(an)
        break
    else:
        print(-1)
        break

### FIXED CODE ###

S=input()
T=input()
an=0
for i in range(3):
    if S[i]==T[i]:
        an+=1
print(an)
import sys
sys.setrecursionlimit(200005)
n, q = map(int, input().split())

to = [[] for i in range(n+1)]


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

score = [0]*(n+1)
q = [0] * (n+1)
for i in range(q):
    p, x = map(int, input().split())
    q[p] += x


def down_tree(index, parent):
    global score
    score[index] += score[parent] + q[index]
    for i in to[index]:
        if i == parent:
            continue
        down_tree(i, index)
    return


down_tree(1, 1)

print(*score[1:])

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(200005)
n, q = map(int, input().split())

to = [[] for i in range(n+1)]


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

score = [0]*(n+1)
for i in range(q):
    p, x = map(int, input().split())
    score[p] += x


def down_tree(index, parent):
    for i in to[index]:
        if i == parent:
            continue
        score[i] += score[index]
        down_tree(i, index)



down_tree(1, 1)

print(' '.join(map(str, score[1:])))
n, t = map(int, input().split())
c_lists = []
t_lists = []
for i in range(n):
  c_i, t_i = map(int, input().split())
  c_lists.append(c_i)
  t_lists.append(t_i)

costs = []
for j in range(n):
    if t_lists[j] <= t:
        costs.append(c_lists[j])
if costs == []:
    ans = 'TLE'
else:
    minimum = costs[0]
    for k in costs[1:]:
        if k < minimum:
            minimum = k
            ans = k
print(ans)

### FIXED CODE ###

n, t = map(int, input().split())
c_lists = []
t_lists = []
for i in range(n):
  c_i, t_i = map(int, input().split())
  c_lists.append(c_i)
  t_lists.append(t_i)

costs = []
for j in range(n):
    if t_lists[j] <= t:
        costs.append(c_lists[j])
if not costs:
    ans = 'TLE'
else:
    costs.sort()
    ans = costs[0]
print(ans)
n,m = map(int,input().split())
f = [False for _ in range(n)]
a = [[] for _ in range(n)]
for _ in range(m):
    x,y,z = map(int,input().split())
    a[x-1].append(y-1)
    a[y-1].append(x-1)

def dfs(i):
    global f
    global a
    f[i] = True
    for g in a[i]:
        if not f[g]:
            dfs(g)
res = 0
for i in range(n):
    if not f[i]:
        res += 1
        dfs(i)

print(res)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
n,m = map(int,input().split())
f = [False for _ in range(n)]
a = [[] for _ in range(n)]
res = 0

def dfs(k):
    f[k] = True
    for g in a[k]:
        if not f[g]:
            dfs(g)

for _ in range(m):
    x,y,z = map(int,input().split())
    a[x-1].append(y-1)
    a[y-1].append(x-1)

for i in range(n):
    if not f[i]:
        res += 1
        dfs(i)
print(res)
N = list(map(int,input()))
count = 1
count_list = list()
for i in range(3):
	if N[i] == N[i+1]:
		count += 1
	else:
		count_list.append(count)
		count = 1
print('Yes') if max(count_list) >= 3 else print('No')

### FIXED CODE ###

N = list(map(int,input()))
count = 1
for i in range(3):
	if N[i] == N[i+1]:
		count += 1
		if count == 3:
			break
	else:
		count = 1

print('Yes') if count >= 3 else print('No')
from collections import Counter

N = int(input())
balls = [tuple(map(int, input().split())) for _ in range(N)]

diffs = Counter()
for i in range(N):
    x1, y1 = balls[i]
    for j in range(i+1, N):
        x2, y2 = balls[j]
        diffs.update([(x2-x1, y2-y1)])

ans = N - diffs.most_common(1)[0][1]
print(ans)


### FIXED CODE ###

N = int(input())
balls = [tuple(map(int, input().split())) for _ in range(N)]

balls.sort()

ans = N
for i in range(N):
    for j in range(i+1, N):
        p, q = balls[j][0]-balls[i][0], balls[j][1]-balls[i][1]
        useds = [False] * N
        num = 0
        for a in range(N):
            if useds[a]: continue
            useds[a] = True
            num += 1
            x, y = balls[a]
            for b in range(a+1, N):
                if useds[b]: continue
                if balls[b] == (x+p, y+q):
                    useds[b] = True
                    x, y = balls[b]
        ans = min(ans, num)

print(ans)
n, m = map(int, input().split())
all = {int(i) for i in range(1, i + 1)}
for _ in range(n):
    k, *i_th = map(int, input().split())
    all &= set(list(i_th))
print(len(all))

### FIXED CODE ###

n, m = map(int, input().split())
all = {int(i) for i in range(1, m + 1)}
for _ in range(n):
    k, *i_th = map(int, input().split())
    all &= set(i_th)
print(len(all))
n = int(input())
a = list(map(int, input.split()))
d = set()
for x in a:
  if x in d:
    print("NO")
    quit()
  d.add(x)
print("YES")

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
d = set()
for x in a:
  if x in d:
    print("NO")
    quit()
  d.add(x)
print("YES")
import sys
N = int(input())

time_lis = [0] * N
profit = [0] * N
for n in range(N):
    time_lis[n] = list(map(int, input().split()))
for n in range(N):
    profit[n] = list(map(int, input().split()))

ans = 0
always_zero = True
for n in range(N):
    count_1 = len([i for i in time_lis[n] if i == 1])
    ans += max(profit[n][:count_1 + 1])
    if profit[n].index(ans) != 0:
        always_zero = False
if always_zero:
    max_prof = [item[1] for item in profit]
    print(max(max_prof))
    sys.exit()
print(ans)

### FIXED CODE ###

n=int(input())
F=[[] for i in range(10)]
for i in range(n):
    for j,f in enumerate(list(map(int,input().split()))):
        if f:
            F[j].append(i)
P=[list(map(int,input().split())) for i in range(n)]
ans=-float("inf")
for i in range(1,1024):
    l=[0]*n
    for j in range(10):
        if i>>j&1:
            for k in F[j]:
                l[k]+=1
    t=0
    for j,k in enumerate(l):
        t+=P[j][k]
    ans=max(ans,t)
print(ans)
A, B, C, D = map(int, input().split())

print(min(A, B) + min(C, D))

### FIXED CODE ###

A, B, C, D = [int(input()) for i in range(4)]

print(min(A, B) + min(C, D))
n = int(input())
list = []
for _ in range(n):
    command = input().split()
    if command[0] == 'insert':
        num = int(command[1])
        list.insert(0, num)
    elif command[0] == 'delete':
        num = int(command[1])
        list.remove(num)
    elif command[0] == 'deleteFirst':
        list.pop(0)
    elif command[0] == 'deleteLast':
        list.pop()

print(" ".join(map(str, list)))

### FIXED CODE ###

from collections import deque
import sys

dq = deque()
num = int(sys.stdin.readline())
line = sys.stdin.readlines()

for i in range(num):

    order = line[i].split()

    if order[0] == 'insert':
        dq.appendleft(order[1])
    elif order[0] == 'deleteFirst':
        dq.popleft()
    elif order[0] == 'deleteLast':
        dq.pop()
    else:
        if order[1] in dq:
            dq.remove(order[1])

print(' '.join(dq))
#!/usr/bin/env python3
import sys
MOD = 1000000007  # type: int

def permutations_count(n, k):
    if k == 0:
        return 1
    return n * permutations_count(n-1, k-1) % MOD

def solve(N: int, K: int, a: "List[int]", b: "List[int]"):
    matrix = [[] for _ in range(N+1)]
    for i in range(N-1):
        matrix[a[i]].append(b[i])
        matrix[b[i]].append(a[i])
    
    visited = [0]*(N+1)

    from collections import deque
    queue = deque()
    visited[1]=1
    answer = K
    answer *= permutations_count(K-1,len(matrix[1]))
    for node in matrix[1]:
        queue.append(node)

    while queue:
        q = queue.popleft()

        if visited[q] == 0:
            if K-2 < len(matrix[q])-1:
                print(0)
                return
            answer *= permutations_count(K-2,len(matrix[q])-1) #親ノード引いてる
        else:
            continue

        visited[q] = 1

        for child_node in matrix[q]:
            if child_node != q:
                queue.append(child_node)

    print(answer%MOD)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    a = [int()] * (N - 1)  # type: "List[int]"
    b = [int()] * (N - 1)  # type: "List[int]"
    for i in range(N - 1):
        a[i] = int(next(tokens))
        b[i] = int(next(tokens))
    solve(N, K, a, b)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
MOD = 1000000007  

def solve(N: int, K: int, a: "List[int]", b: "List[int]"):
    matrix = [[] for _ in range(N+1)]
    for i in range(N-1):
        matrix[a[i]].append(b[i])
        matrix[b[i]].append(a[i])
    
    visited = [0]*(N+1)

    from collections import deque
    queue = deque()
    visited[1]=1
    answer = K
    num = K-1
    for node in matrix[1]:
        answer *= num
        answer %= MOD

        num -= 1
        queue.append(node)

    while queue:
        q = queue.popleft()
        if visited[q] != 0:
            continue
        visited[q] = 1

        num = K-2
        for child_node in matrix[q]:
            if visited[child_node] == 0:
                answer *= num
                answer %= MOD
                num -= 1
                queue.append(child_node)
        answer %= MOD

    print(answer%MOD)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    a = [int()] * (N - 1)  # type: "List[int]"
    b = [int()] * (N - 1)  # type: "List[int]"
    for i in range(N - 1):
        a[i] = int(next(tokens))
        b[i] = int(next(tokens))
    solve(N, K, a, b)

if __name__ == '__main__':
    main()
r = int(input())
print r*r


### FIXED CODE ###

r=int(input())
print(r*r)
n = int(input())
s = list(input())
S = len(s)
l = []

if n>=S:
  for i in range(n):
    l.append(s[i])
    print(len(set(l)))

elif n<S:
  for i in range(S):
    l.append(s[i])
    print(len(set(l)))

### FIXED CODE ###

n = int(input())
s = [input() for i in range(n)]
S = len(set(s))

print(S)
import sys
import math
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def Intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

x,n = I2()
if n != 0:
    p = Intl()
else:
    p = []
p.sort()
if not x in p:
    print(x)
else:
    b,e = 0,n-1
    for i in range(n):
        if p[i] == x:
            b = max(b,i-1)
            e = min(e,i+1)
            break
    #print(b,e)
    r = []
    s = []
    for i in range(p[b],p[e]+2):
        if i not in p:
            r.append(i)
            s.append(abs(x-i))
    print(r[s.index(min(s))])

### FIXED CODE ###

import sys
import math
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def Intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

x,n = I2()
if n != 0:
    p = Intl()
else:
    p = []
p.sort()
if not x in p:
    print(x)
else:
    b,e = 0,n-1
    r = []
    s = []
    for i in range(min(p)-1,max(p)+2):
        if i not in p:
            r.append(i)
            s.append(abs(x-i))
    print(r[s.index(min(s))])
x = raw_input()
x = int(x)
print x = x^3

### FIXED CODE ###

x = raw_input()
x = int(x)
x = x * x * x
print x
N = int(input())
monsters = list(map(int, input().split()))
def gcd(a, b):
	if b > 0 :
      return gcd(b , a % b)
    else :
      return x
if len(monster) == 1 :
	print(monster[0])
else :
    mon = gcd(monster[0], monster[1])
    if len(monster) >= 2
    for i in range(2 , N) :
      mon = gcd(mon, monster[i])
print(mon)
    
    
    
     


### FIXED CODE ###

N = int(input())
monster = list(map(int, input().split()))
def gcd(a, b):
	if b > 0 :
		return gcd(b, a % b)
	else:
		return a
if len(monster) == 1 :
	print(monster[0])
else:
	mon = gcd(monster[0], monster[1])
	if len(monster) != 2 :
		for i in range(2, N) :
			mon = gcd(mon, monster[i])
print(mon)