def gcd(x, y):
  if y == 0:
    return x
  else:
    return gcd(y, x % y)

def resolve():
  n = int(input())
  a = list(map(int, input().split()))
  ans = a[0]
  for x in a:
    ans = gcd(ans, x)

  print(ans)
  return

if __name__ == "__main__":
  resolve() def gcd(x, y):
  if y == 0:
    return x
  else:
    return gcd(y, x % y) gcd if y == 0:
    return x
  else:
    return gcd(y, x % y) y == 0 y 0 return x x return gcd(y, x % y) gcd(y, x % y) gcd y x % y x y x x y y def resolve():
  n = int(input())
  a = list(map(int, input().split()))
  ans = a[0]
  for x in a:
    ans = gcd(ans, x)

  print(ans)
  return resolve n = int(input()) n int(input()) int input() input a = list(map(int, input().split())) a list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split ans = a[0] ans a[0] a 0 for x in a:
    ans = gcd(ans, x)

   x a ans = gcd(ans, x) ans gcd(ans, x) gcd ans x print(ans) print ans return if __name__ == "__main__":
  resolve() __name__ == "__main__" __name__ "__main__" resolve() resolve def resolve():
  n = int(input())
  a = list(map(int, input().split()))
  ans = a[0]
  for x in a:
    ans = gcd(ans, x)

  print(ans)
  return def resolve():
  n = int(input())
  a = list(map(int, input().split()))
  ans = a[0]
  for x in a:
    ans = gcd(ans, x)

  print(ans)
  return resolve def gcd(x, y):
  if y == 0:
    return x
  else:
    return gcd(y, x % y) def gcd(x, y):
  if y == 0:
    return x
  else:
    return gcd(y, x % y) gcd
def gcd(x, y):
  if y == 0:
    return x
  else:
    return gcd(y, x % y)

def resolve():
  n = int(input())
  a = list(map(int, input().split()))
  ans = a[0]
  for x in a:
    ans = gcd(ans, x)

  print(ans)
  return

if __name__ == "__main__":
  resolve()
