program gcd_on_blackboard
  implicit none
  integer :: n, a(100000), i, j, g, m
  a = 0
  read(*,*) n
  read(*,*) a(1:n)
  call merge_sort(n,a(1:n))
  m = 1
  do j = 1, n
    g = a(1)
    if (j.eq.1) g = a(2)
    do i = 1, n
      if (i.eq.j) cycle
      if (g.le.m) exit
      g = gcd(a(i),g)
    end do
    if (m.lt.g) m = g
  end do
  write(*,'(i0)') m
  stop
contains
  recursive function gcd(n,m) result(g)
    implicit none
    integer, intent(in) :: n, m
    integer :: g
    if (n.lt.m) then
      g = gcd(m,n)
    else if (mod(n,m).eq.0) then
      g = m
    else
      g = gcd(m,mod(n,m))
    end if
  end function gcd
  subroutine merge_sort(n,c)
    implicit none
    integer, intent(in) :: n
    integer, intent(inout) :: c(n)
    integer :: num, lng, i, ubnd
    num = n
    lng = 1
    do while (num.gt.1)
      do i = 1, num/2
        ubnd = min(2*i*lng,n)
        call merge(c(2*(i-1)*lng+1:(2*i-1)*lng),c((2*i-1)*lng+1:ubnd))
      end do
      lng = 2*lng
      num = (num+1)/2
    end do
    return
  end subroutine merge_sort
  subroutine merge(c1,c2)
    implicit none
    integer, intent(inout) :: c1(:), c2(:)
    integer :: c(size(c1)+size(c2))
    integer :: i1, i2, n1, n2
    i1 = 1
    i2 = 1
    n1 = size(c1)
    n2 = size(c2)
    do while (i1.le.n1.and.i2.le.n2)
      if (c1(i1).ge.c2(i2)) then
        c(i1+i2-1) = c1(i1)
        i1 = i1+1
      else
        c(i1+i2-1) = c2(i2)
        i2 = i2+1
      end if
    end do
    if (i1.le.n1) then
      c(i1+i2-1:n1+n2) = c1(i1:n1)
    else if (i2.le.n2) then
      c(i1+i2-1:n1+n2) = c2(i2:n2)
    end if
    c1 = c(1:n1)
    c2 = c(n1+1:n1+n2)
    return
  end subroutine merge
end program gcd_on_blackboard