CodeEff/ECCO huggingface dataset:
# Original solution
N = 100000
g = [[] for i in range(N)] 
  
# To check if the vertex  
# has been visited or not 
vis = [False for i in range(N)] 
  
# To store if vertex is reachable 
# from source or not 
good = [False for i in range(N)] 
  
def ADD_EDGE(u, v): 
  
    g[u].append(v) 
  
# Function to find all good vertices 
def dfs1(v): 
  
    good[v] = True
    for to in g[v]: 
        if not good[to]: 
            dfs1(to) 
  
# Function to find cnt of 
# all unreachable vertices 
def dfs2(v): 
      
    global cnt 
    vis[v] = True
    cnt += 1
    for to in g[v]: 
        if not vis[to] and not good[to]: 
            dfs2(to) 
  
# Function to return   
# the minimum edges required 
def Minimum_Edges(): 
  
    global vis, cnt 
      
    # Find all vertices reachable 
    # from the source 
    dfs1(x) 
  
    # To store all vertices  
    # with their cnt value 
    val = [] 
  
    for i in range(0, n):  
  
        # If vertex is bad i.e. not reachable 
        if not good[i]: 
            cnt = 0
            vis = [False for i in range(N)] 
  
            # Find cnt of this vertex 
            dfs2(i) 
            val.append((cnt, i)) 
  
    # Sort all unreachable vertices  
    # in non-decreasing order of 
    # their cnt values 
    val.sort(reverse = True) 
  
    # Find the minimum number of edges 
    # needed to be added 
    ans = 0
    for it in val:  
        if not good[it[1]]:  
            ans += 1
            dfs1(it[1]) 
  
    return ans 
  
# Driver code 
if __name__ == "__main__": 
  
    # Number of nodes and source node 
    n, m = list(map(int, input().split()))
    x = 0
  
    # Add edges to the graph
    for i in range(m):
        u, v = list(map(int, input().split()))
        ADD_EDGE(u, v)
  
    print((Minimum_Edges()))


# Optimized solution
import sys
input = sys.stdin.readline
 
n,m=list(map(int,input().split()))
d={i+1:[] for i in range(n)}
for i in range(m):
    x,y=list(map(int,input().split()))
    d[x].append(y)
    d[y].append(x)
 
visit=set()
ans= 0 
for i in range(1,n+1):
    if i not in visit:
        ans+=1
        stack = [i]
        while stack:
            c=stack.pop()
            visit.add(c)
            for i in d[c]:
                if i not in visit:
                    stack.append(i)
print((ans-1))
# Original solution
N, M = list(map(int, input().split()))
L = [0] * N
D = {}
c = 1
for i in range(M):
  A, B = list(map(int, input().split()))
  if L[A - 1] == L[B - 1] == 0:
    D[c] = set()
    D[c].add(A)
    D[c].add(B)
    L[A - 1] = c
    L[B - 1] = c
    c += 1
  elif L[A - 1] == 0:
    D[L[B - 1]].add(A)
    L[A - 1] = L[B - 1]
  elif L[B - 1] == 0:
    D[L[A - 1]].add(B)
    L[B - 1] = L[A - 1]
  elif L[A - 1] != L[B - 1]:
    D[L[A - 1]] |= D[L[B - 1]]
    for j in D.pop(L[B - 1]):
      L[j - 1] = L[A - 1]
  #print(L, D, sep = "\n")
print((len(D) + L.count(0) - 1))

# Optimized solution
N, M = list(map(int, input().split()))
L = [0] * N
D = {}
c = 1
for i in range(M):
  A, B = list(map(int, input().split()))
  if L[A - 1] == L[B - 1] == 0:
    D[c] = set()
    D[c].add(A)
    D[c].add(B)
    L[A - 1] = c
    L[B - 1] = c
    c += 1
  elif L[A - 1] == 0:
    D[L[B - 1]].add(A)
    L[A - 1] = L[B - 1]
  elif L[B - 1] == 0:
    D[L[A - 1]].add(B)
    L[B - 1] = L[A - 1]
  elif L[A - 1] != L[B - 1]:
    if len(D[L[A - 1]]) < len(D[L[B - 1]]):
      A, B = B, A
    D[L[A - 1]] |= D[L[B - 1]]
    for j in D.pop(L[B - 1]):
      L[j - 1] = L[A - 1]
  #print(L, D, sep = "\n")
print((len(D) + L.count(0) - 1))
# Original solution

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

def g(u,parent):
    if parent[u]!= u:
        parent[u] = g(parent[u], parent)
    return parent[u]
parent = {u:u for u in range(1, n+1)}
for _ in range(m):
    u,v = list(map(int, input().split()))
    pu,pv = g(u,parent), g(v,parent)
    if pu!= pv:
        parent[pu] = pv

ans = 0
for u in parent:
    if g(u,parent) == u:
        ans+=1
print(ans -1)

# Optimized solution

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

def g(u,parent):
    if parent[u]!= u:
        parent[u] = g(parent[u], parent)
    return parent[u]
parent = list(range(n+1))
for _ in range(m):
    u,v = list(map(int, input().split()))
    pu,pv = g(u,parent), g(v,parent)
    if pu!= pv:
        parent[pu] = pv

ans = 0
for u in range(1, n+1):
    if g(u,parent) == u:
        ans+=1
print(ans -1)
# Original solution
import sys
sys.setrecursionlimit(2 * (10 ** 6))
n, m = list(map(int, input().split()))
edges = [[] for i in range(n)]
visit = [False for i in range(n)]
def dfs(v):
    visit[v] = True
    for i in edges[v]:
        if not visit[i]:
            dfs(i)
for i in range(m):
    a, b = list(map(int, input().split()))
    edges[a - 1].append(b - 1)
    edges[b - 1].append(a - 1)
cnt = 0
for i in range(n):
    if not visit[i]:
        dfs(i)
        cnt += 1
print((cnt - 1))

# Optimized solution
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.par = list(range(self.n))
        self.rank = [1] * n
        self.cnt = n
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]
    def unite(self, x, y):
        p = self.find(x)
        q = self.find(y)
        if p == q:
            return None
        if p > q:
            p, q = q, p
        self.rank[p] += self.rank[q]
        self.par[q] = p
        self.cnt -= 1
    def same(self, x, y):
        return self.find(x) == self.find(y)
    def size(self, x):
        return self.rank[x]
    def count(self):
        return self.cnt
n, m = list(map(int, input().split()))
UF = UnionFind(n)
for _ in range(m):
    a, b = list(map(int, input().split()))
    UF.unite(a - 1, b - 1)
print((UF.count() - 1))
# Original solution
n,m=list(map(int,input().split()))
xy = [list(map(int, input().split())) for _ in range(m)]
x, y = [list(i) for i in zip(*xy)]
ans=0

l=[-1]*n

def rootfind(a):
    while 1:
        if l[a-1]>0:
            a=l[a-1]
        else:
            break
    return a


def rootunion(c,d):
    cr=rootfind(c)
    dr=rootfind(d)
    if cr==dr:
        pass
    else:
        l[cr-1]=dr


for j in range(m):
    p=x[j]
    q=y[j]
    rootunion(p,q)

for o in l:
    if o<0:
        ans+=1

print((ans-1))

# Optimized solution
n,m=list(map(int,input().split()))
xy = [list(map(int, input().split())) for _ in range(m)]
x, y = [list(i) for i in zip(*xy)]
ans=0

l=[-1]*n

def rootfind(a):
    changelist=[]
    while 1:
        if l[a-1]>0:
            changelist.append(a)
            a=l[a-1]
        else:
            break
    for e in changelist:
        l[e-1]=a
    return a


def rootunion(c,d):
    cr=rootfind(c)
    dr=rootfind(d)
    if cr==dr:
        pass
    else:
        l[cr-1]=dr


for j in range(m):
    p=x[j]
    q=y[j]
    rootunion(p,q)

for o in l:
    if o<0:
        ans+=1

print((ans-1))
# Original solution
n,m=list(map(int,input().split()))
data=list(range(n))
cnt=n-1
for i in range(m):
    a,b=list(map(int,input().split()))
    a-=1
    b-=1
    while data[a]!=a:
        a=data[a]
    while data[b]!=b:
        b=data[b]
    if a!=b:
        data[a]=b
        cnt-=1
print(cnt)

# Optimized solution
n,m=list(map(int,input().split()))
data=list(range(n))
cnt=n-1
def find(x):
    if data[x]==x:
        return x
    else:
        data[x]=find(data[x])
        return data[x]
for i in range(m):
    a,b=list(map(int,input().split()))
    a=find(a-1)
    b=find(b-1)
    if a!=b:
        data[a]=b
        cnt-=1
print(cnt)
# Original solution
_=int(eval(input()));print((['Three','Four']['Y'in input().split()]))

# Optimized solution
N=eval(input());print((['Three','Four']['Y'in input().split()]))
# Original solution
n = eval(input())
str = input().split()
dict = []
for s in str:
    if not s in dict:
        dict.append(s)
print(("Three" if len(dict) == 3 else "Four"))

# Optimized solution
n = eval(input())
dict = set(input().split())
print(("Three" if len(dict) == 3 else "Four"))
# Original solution
from collections import Counter
n = int(eval(input()))
s = list(map(str, input().split()))
if len(Counter(s)) == 4:
	print ("Four")
else:
	print ("Three")

# Optimized solution
n = int(eval(input()))
s = list(map(str, input().split()))
ss = set(s)
if len(ss) == 3:
	print ("Three")
else:
	print ("Four")
# Original solution
n = int(eval(input()))
s = list(map(str, input().split()))
d = {}
for i in range(n):
    if s[i] not in d:
        d[s[i]] = 1
    else:
        d[s[i]] += 1
if len(list(d.keys())) == 3:
    print('Three')
else:
    print('Four')
#print(d)

# Optimized solution
n = int(eval(input()))
s = list(map(str, input().split()))
if len(set(s)) == 4:
    print('Four')
else:
    print('Three')
# Original solution
n=int(eval(input()))
s=list(map(str,input().split()))
total=[]
for i in range(n):
    if s[i] not in total:
        total.append(s[i])
print(('Three' if len(total)==3 else 'Four'))

# Optimized solution
eval(input())
l=list(map(str,input().split()))
print(('Three' if len(set(l))==3 else 'Four'))
# Original solution
N = int(eval(input()))
S = list(map(str, input().split()))
A = 0
for i in range(N):
    for j in range(N-1):
        for k in range(N-2):
            for l in range(N-3):
                if S[i] != S[j+1] and S[j+1] != S[k+2]and S[k+2] != S[l+3] and S[l+3] != S[i] and S[j+1] != S[l+3] and S[i] != S[k+2]:
                    A = A+1
if A != 0:
    print("Four")
else:
    print("Three")


# Optimized solution
N = int(eval(input()))
S = list(map(str, input().split()))
if ("P"and "W" and "G" and "Y") in S:
    print("Four")
else:
    print("Three")
# Original solution
import sys

n, *s = sys.stdin.read().split()

def main():
    return 'Four' if len(set(s)) == 4 else 'Three'

if __name__ == '__main__':
    ans = main()
    print(ans)

# Optimized solution
import sys
n, *s = sys.stdin.read().split()

def main():
  print(('Four' if len(set(s)) == 4 else 'Three'))
  
if __name__ == '__main__':
  main()
# Original solution
def main():
    N = int(eval(input()))
    A = [i for i in input().split()]
    ans = ["Three", "Four"]
    print((ans[0] if len(set(A)) == 3 else ans[1]))


if __name__ == '__main__':
    main()


# Optimized solution
def main():
    N = int(eval(input()))
    A = {i for i in input().split()}
    if "Y" in A:
        print("Four")
    else:
        print("Three")


if __name__ == '__main__':
    main()
# Original solution
n = int(eval(input()))
s = list(map(str,input().split()))
a = len(list(set(s)))
if a==3:
    print("Three")
else:
    print("Four")

# Optimized solution
n = int(eval(input()))
s = list(map(str,input().split()))
if "Y" in s:
    print("Four")
else:
    print("Three")
# Original solution
from collections import Counter

n = eval(input())
s = input().split()
ss = Counter(s)
print(('Three' if len(ss) == 3 else 'Four'))


# Optimized solution
n = eval(input())
s = set(input().split())
print(('Three' if len(s) == 3 else 'Four'))
# Original solution
n = int(eval(input()))
s = input().split()
s = set(s)
print(('Four' if len(s) == 4 else 'Three'))

# Optimized solution
n = int(eval(input()))
s = input().split()
print(('Four' if len(set(s)) == 4 else 'Three'))
# Original solution
n=int(eval(input()))

t = input().split()
count = []
memo = 0
for i in t:
    if i in count:
        continue
    count.append(i)
    memo += 1
if memo == 3:
    print('Three')
else:
    print('Four')

# Optimized solution
n = int(eval(input()))

s = list(map(str,input().split()))

if "Y" in s:
    print("Four")
else:
    print("Three")
# Original solution
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
INF = float("inf")
import sys
sys.setrecursionlimit(10000)


def solve(N, S):
    if "Y" in S:
        return "Four"
    else:
        return "Three"


def main():
    N = int(eval(input()))
    S = list(input().split())
    print((solve(N, S)))


if __name__ == '__main__':
    main()


# Optimized solution
#!/usr/bin/python3

from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def main():
    N = int(eval(input()))
    S = list(input().split())

    if "Y" in S:
        print("Four")
    else:
        print("Three")

if __name__ == '__main__':
    main()
# Original solution
n = int(eval(input()))
s = list(input().split())
P = s.count("P")
W = s.count("W")
G = s.count("G")
print(("Three" if n==P+W+G else "Four"))

# Optimized solution
eval(input())
s = list(map(str,input().split()))
print(("Three" if len(set(s))==3 else "Four"))
# Original solution
N = int(eval(input()))
l = list(map(str, input().split()))
s = set(l)
if len(s)==3:
  print('Three')
else:
  print('Four')

# Optimized solution
n = int(eval(input()))
l = list(input().split())
if len(set(l)) == 4:
    print('Four')
else:
    print('Three')
# Original solution
from collections import Counter
N = eval(input())
color_list = [i for i in input().split()]
result = len(Counter(color_list))

if result == 3:
    result = 'Three'
elif result == 4:
    result = 'Four'

print(result)

# Optimized solution
N = input()
color_list = [i for i in input().split()]
print('Four') if 'Y' in color_list else print('Three')
# Original solution
N = int(eval(input()))
S = input().split()
print(('Three' if len(set(S))==3 else 'Four'))

# Optimized solution
N = int(eval(input()))
S = set(input().split())
print(('Four' if len(S)==4 else 'Three'))
# Original solution
N = int(eval(input()))
S = list(map(str, input().split()))

candy_list = ['P', 'W', 'G', 'Y']
answer = 0
for i in range(4):
    if candy_list[i] in S:
        answer += 1

if answer == 3:
    print('Three')
if answer == 4:
    print('Four')

# Optimized solution
N = int(eval(input()))
S = list(map(str, input().split()))

if 'Y' in S:
    answer = 'Four'
else:
    answer = 'Three'
print(answer)
# Original solution
n = int(eval(input()))
flag = False
s = input().split(" ")
for c in s:
  if(c == "Y"):
    flag = True

if(flag):
  print("Four")
else:
  print("Three")

# Optimized solution
n = int(eval(input()))
s = input().split()

for i in s:
  if(i == 'Y'):
    print('Four')
    exit()
print('Three')
# Original solution
N = int(eval(input()))
S = list(set(input().split()))
if(len(S) == 4):
  print("Four")
else:
  print("Three")

# Optimized solution
N = int(eval(input()))
S = input().split()
if(len(set(S)) == 4):
  print("Four")
else:
  print("Three")
# Original solution
n = int(eval(input()))
ls = [s.rstrip() for s in input().split()]
if ls.count('Y') > 0:
    print('Four')
else:
    print('Three')

# Optimized solution
eval(input())
ls = list(input().split())
if ls.count('Y') > 0:
    print('Four')
else:
    print('Three')
# Original solution
n=int(eval(input()))
print(("Three" if len(set(list(input().split())))==3 else "Four"))

# Optimized solution
n=eval(input())
print(("Three" if len(set(list(input().split())))==3 else "Four"))
# Original solution
eval(input())
s=input().split()
print(('Four' if 'Y' in s else 'Three'))

# Optimized solution
n=int(eval(input()))
s=set(input().split())

print(('Three' if len(s)==3 else 'Four'))
# Original solution
N = int(eval(input()))
S = list(map(str,input().split()))
if S.count("Y") == 0:
  print("Three")
else:
  print("Four")

# Optimized solution
N = int(eval(input()))
for i in (list(input().split())):
        if i == "Y":
                print("Four")
                exit()

print("Three")
# Original solution
n=int(eval(input()))
s=list(input().split())
if len(set(s))==3:
  print("Three")
if len(set(s))==4:
  print("Four")

# Optimized solution
N = int(eval(input()))
A = input().split()

if len(set(A)) <= 3:
    print("Three")
else:
    print("Four")
# Original solution
N=int(eval(input()))
S=list(map(int,input().split()))



while len(S)!=1:
    
    S.sort()
    
    if S[1]%S[0]==0:
        S.pop(1)
    
    else:
        S[1]=S[1]%S[0]

    if S[0]==1:
        print((1))
        exit()
print((S[0]))

# Optimized solution
import math

N=int(eval(input()))
S=list(map(int,input().split()))
F=S[0]
for i in range(N-1):
    F=math.gcd(F,S[i+1])

print(F)
# Original solution
#dpでできないかな？
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi
from operator import itemgetter
def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
def LI2(): return [int(eval(input())) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print(('\n'.join(x)))
def printni(x): print(('\n'.join(list(map(str,x)))))
inf = 10**17
mod = 10**9 + 7

n=I()
lis=LI()
lis=sorted(lis)
#print(lis)

for i in range(1,n):
    lis[i]=lis[i]%lis[0]
lis.append(0)
lis=sorted(list(set(lis)))
    
while len(lis)>2:
    for i in range(2,len(lis)):
        lis[i]=lis[i]%lis[1]
    lis.append(0)
    lis=sorted(list(set(lis)))
#print(lis)
print((lis[-1]))
#print(lis[0])

# Optimized solution
#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))
def LI2(): return [int(eval(input())) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print(('\n'.join(x)))
def printni(x): print(('\n'.join(list(map(str,x)))))
inf = 10**17
mod = 10**9 + 7

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

n=I()
lis=LI()
p=lis[0]
for i in range(n-1):
    p=gcd(p,lis[i+1])
print(p)
# Original solution
import sys
sys.setrecursionlimit(10**6)
def f(a,*b):
    if len(b)>1:
        return f(a,f(*b))
    b=b[0]
    if b:
        return f(b,a%b)
    return a
n=int(eval(input()))
a=list(map(int,input().split()))
print((f(*a)))

# Optimized solution
def f(a,b):
    if b:
        return f(b,a%b)
    return a
n=int(eval(input()))
a=list(map(int,input().split()))
p=f(a[0],a[1])
for i in a:
    p=f(p,i)
print(p)
# Original solution
n = int(eval(input())) #整数
a = [int(i) for i in input().split() ]

a = list(set(a))
a.sort()
while len(a) > 1:
    while (a[0] < a[1]):
        a[1] %= a[0]
    a = list(set(a))
    a.sort()
    if a[0] == 0:
        a.pop(0)
    if a[0] == 1:
        break
print((a[0]))

# Optimized solution
n = int(eval(input())) #整数
a = [int(i) for i in input().split() ]

a = list(set(a))
a.sort()
while len(a) > 1:
    while (a[0] < a[1]):
        a[1] %= a[0]
    x = a[1]
    a[1] = a[0]
    a[0] = x
    if a[0] == 0:
        a.pop(0)
    if a[0] == 1:
        break
print((a[0]))
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))

A.sort(reverse=True)

denominator = 0
numerator = 1
while A[numerator] != 0:
    A[denominator] = A[denominator] % A[numerator]
    if A[denominator] == 0:
        denominator += 1
        numerator += 1
        if denominator >= N or numerator >= N:
            break
    else:
        denominator, numerator = numerator, denominator
print((min([a for a in A if a > 0])))

# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))

def gcd(a, b):
    if a % b == 0:
        return b
    else:
        return gcd(b, a%b)

ans = gcd(A[0], A[1])
if N > 2:
    for i in range(2, N):
        ans = gcd(ans, A[i])

print(ans)
# Original solution

import math

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

x = A[0]
for a in A:
    x = math.gcd(x, a)

print(x)



# Optimized solution

import math
N = int(eval(input()))
A = [int(x) for x in input().split()]

ans = A[0]
for a in A[1:]:
    ans = math.gcd(a, ans)

print(ans)
# Original solution
n = int(eval(input()))
a = list(map(int, input().split()))

if len(set(a)) == 1:
    print((a[0]))
else:
    a.sort()
    count = 0
    while(1):
        count = count + 1
        for i in range(1, len(a)):
            x = a[i] + count
            for j in range(i):
                x = x % a[i-1-j]
        if x == 0:
            break

    print(count)


# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))


def gcd(a, b):
    if a <= b:
        if b % a == 0:
            return a
        else:
            return(gcd(b % a, a))
    else:
        if a % b == 0:
            return b
        else:
            return(gcd(a % b, b))


ans = gcd(a[0], a[1])

for i in range(2, len(a)):
    ans = gcd(ans, a[i])

print(ans)
# Original solution
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)
N = int(eval(input()))
A = list(map(int,input().split()))
A.sort(reverse=True)
a = A[0]
for i in range(1,N):
    a = gcd(a,A[i])
print(a)


# Optimized solution
def gcd(a, b):
    if b > a:
        a,b = b,a
    if b == 0:
        return a
    else:
        return gcd(b, a % b)
N = int(eval(input()))
A = list(map(int,input().split()))
a = A[0]
for i in range(1,N):
    a = gcd(a,A[i])
print(a)
# Original solution
def divisor(n): 
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table

def main():
    n = int(eval(input()))
    a = list(map(int, input().split()))
    
    ans = set(divisor(a[0]))
    for i in range(1, n):
        tmp = set(divisor(a[i]))
        ans = ans & tmp
    
    print((max(ans)))

    
if __name__ == '__main__':
    main()

# Optimized solution
def main():
    n = int(eval(input()))
    a = list(map(int, input().split()))
    m = min(a)
    next_m = m
    count = 0
    while count != n:
        m = next_m
        count = 0
        pre = a[0]
        for i in range(n):
            if a[i] == pre:
                count += 1
            a[i] %= m
            if a[i] != 0:
                next_m = min(next_m, a[i])
            else:
                a[i] = m
            pre = a[i]
    print(m)
    
if __name__ == '__main__':
    main()
# Original solution
N=int(eval(input()))
A=list(map(int,input().split()))

while len(set(A))!=1:
#for i in range(2):
    A.sort()
    for i in range(len(A)-1):
        if A.count(0):
            A.remove(0)
            break
        A[i+1]=A[i+1]%A[0]

print((max(A)))

# Optimized solution
N=int(eval(input()))
A=list(map(int,input().split()))

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

A.sort()
y=A[0]
for i in range(1,N):
    y=gcd(y,A[i])
print(y)