from fractions import gcd


def main():
    n = int(input())
    a = list(map(int, input().split()))
    ans = a[0]
    for aa in a:
        ans = gcd(ans, aa)
        
    print(ans)
    
    
if __name__ == '__main__':
    main() from fractions import gcd def main():
    n = int(input())
    a = list(map(int, input().split()))
    ans = a[0]
    for aa in a:
        ans = gcd(ans, aa)
        
    print(ans)
    
     main 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 aa in a:
        ans = gcd(ans, aa)
        
     aa a ans = gcd(ans, aa) ans gcd(ans, aa) gcd ans aa print(ans) print ans if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    n = int(input())
    a = list(map(int, input().split()))
    ans = a[0]
    for aa in a:
        ans = gcd(ans, aa)
        
    print(ans)
    
     def main():
    n = int(input())
    a = list(map(int, input().split()))
    ans = a[0]
    for aa in a:
        ans = gcd(ans, aa)
        
    print(ans)
    
     main
from fractions import gcd


def main():
    n = int(input())
    a = list(map(int, input().split()))
    ans = a[0]
    for aa in a:
        ans = gcd(ans, aa)
        
    print(ans)
    
    
if __name__ == '__main__':
    main()