      MODULE gcdMod
! 最小公倍数GCDを求めるモジュール
! ユークリッドの互除法を使用する．
! MODはとっていない.
      IMPLICIT NONE
      
      interface gcd
        module procedure :: intGcd
      end interface
      
      integer(16),parameter,private :: precision = 16
      
      contains
      function intGcd( a,b ) result( gcd )
        implicit none
        integer(precision),intent(in) :: a,b
        integer(precision) :: gcd, smaller, bigger, remain
        
        bigger  = max( a,b )
        smaller = min( a,b )
        
        do while(.true.)
          remain = mod( bigger,smaller )
          if( remain==0 )then
            gcd = smaller; return
          else
            bigger  = smaller
            smaller = remain
          end if
        end do
      end function
      end MODULE gcdMod
      
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      

      PROGRAM piyo
      use gcdMod
      IMPLICIT NONE
      integer(16) :: n,ans
      integer(16),allocatable :: a(:)
      integer(16) :: i
      
      read*,n
      allocate( a(n) )
      read*,a(1:n)
      
      ans = a(1)
      
      do i = 2,n
        ans = gcd( ans,a(i) )
      end do
      
      print*,ans
      
      
      
      
      END PROGRAM