from collections import defaultdict
from collections import deque
from collections import Counter
import itertools
import math

def readInt():
  return int(input())
def readInts():
  return list(map(int, input().split()))
def readChar():
  return input()
def readChars():
  return input().split()

n = readInt()
a = list(set(readInts()))

if len(a)==1:
  print(a[0])
  exit()

odd = []
even = []


from math import gcd


d = a[0]
for i in a:
  d = gcd(i,d)
print(d) from collections import defaultdict from collections import deque from collections import Counter import itertools itertools import math math def readInt():
  return int(input()) readInt return int(input()) int(input()) int input() input def readInts():
  return list(map(int, input().split())) readInts return list(map(int, input().split())) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split def readChar():
  return input() readChar return input() input() input def readChars():
  return input().split() readChars return input().split() input().split() ().split () input split n = readInt() n readInt() readInt a = list(set(readInts())) a list(set(readInts())) list set(readInts()) set readInts() readInts if len(a)==1:
  print(a[0])
  exit() len(a)==1 len(a) len a 1 print(a[0]) print a[0] a 0 exit() exit odd = [] odd [] even = [] even [] from math import gcd d = a[0] d a[0] a 0 for i in a:
  d = gcd(i,d) i a d = gcd(i,d) d gcd(i,d) gcd i d print(d) print d def readInts():
  return list(map(int, input().split())) def readInts():
  return list(map(int, input().split())) readInts def readChar():
  return input() def readChar():
  return input() readChar d = gcd(i,d) gcd(i,d) d odd = [] [] odd def readChars():
  return input().split() def readChars():
  return input().split() readChars a = list(set(readInts())) list(set(readInts())) a even = [] [] even def readInt():
  return int(input()) def readInt():
  return int(input()) readInt n = readInt() readInt() n d = a[0] a[0] d
from collections import defaultdict
from collections import deque
from collections import Counter
import itertools
import math

def readInt():
  return int(input())
def readInts():
  return list(map(int, input().split()))
def readChar():
  return input()
def readChars():
  return input().split()

n = readInt()
a = list(set(readInts()))

if len(a)==1:
  print(a[0])
  exit()

odd = []
even = []


from math import gcd


d = a[0]
for i in a:
  d = gcd(i,d)
print(d)