integer n
integer(16),allocatable,dimension(:)::A
integer(16) gcd,ans
read*,n
allocate(A(n))
read*,A

ans=1
do i=1,N
  gcd=A(mod(i,N)+1)
  do j=1,N
    if(i==j)cycle
    do
      if(mod(A(j),gcd)==0)exit
      gcd= abs(A(j)-gcd)
    end do
  end do
  ans=max(ans,gcd)
end do
print"(I0)",ans
end