PROGRAM ATCODER

implicit none
integer :: n, i, check
integer, allocatable :: a(:), m(:)

read(*,*) n
allocate (a(n), m(n-1))
read(*,*) (a(i), i=1,n)

call hs(n,a)

check = 0
do i = 1, n-1
	m(i) = mod(a(n),a(i))
    if(m(i) /= 0) then
    	check = 1
    end if
end do

if(check == 1)then
	write(*,'(i0)') 1
else
	write(*,'(i0)') a(1)
end if

END PROGRAM ATCODER

subroutine hs(n,array)
  implicit none
  integer,intent(in) :: n
  integer,intent(inout) :: array(1:n)
  
  integer ::i,k,j,l
  integer :: t
  
  if(n <= 0)then
     write(6,*)"Error, at heapsort"; stop
  endif
  if(n == 1)return
 
  l=n/2+1
  k=n
  do while(k /= 1)
     if(l > 1)then
        l=l-1
        t=array(L)
     else
        t=array(k)
        array(k)=array(1)
        k=k-1
        if(k == 1) then
           array(1)=t
           exit
        endif
     endif
     i=l
     j=l+l
     do while(j <= k)
        if(j < k)then
           if(array(j) < array(j+1))j=j+1
        endif
        if (t < array(j))then
           array(i)=array(j)
           i=j
           j=j+j
        else
           j=k+1
        endif
     enddo
     array(i)=t
  enddo
 
  return
end subroutine hs