program main
Implicit None
	integer(8)::n,p1,p2,p3,q,i
	integer(8),allocatable::a(:)
	
	read*,n
	allocate(a(n))
	
	read*,a
	
	if(n == 2)then
		print"(i0)",max(a(1),a(2))
		stop
	endif
	
	q = 0
	call euc(a(1),a(2),p1)
	if(p1 /= 1)then
		do i = 2,n
			if(mod(a(i),p1) /=0) q = q+1
			if(q > 1)then
				p1 = 1
				exit
			endif
		enddo
	endif
	
	q = 0
	call euc(a(1),a(3),p2)
	if(p2 /= 1)then
		do i = 2,n
			if(mod(a(i),p2) /=0) q = q+1
			if(q > 1)then
				p2 = 1
				exit
			endif
		enddo
	endif
	
	q = 0
	call euc(a(2),a(3),p3)
	if(p3 /= 1)then
		do i = 2,n
			if(mod(a(i),p3) /=0) q = q+1
			if(q > 1)then
				p2 = 1
				exit
			endif
		enddo
	endif
	
	print"(i0)",max(p1,p2,p3)
	
end program main

subroutine euc(a1,b1,c)
implicit None
integer(8)::a1,b1,c,a,b
	a = a1
	b = b1
	c = 1
	
	do while (a /=0 .and. b /= 0)
		if (a > b)then
			c = b
			a = mod(a,b)
			else
			c = a
			b = mod(b,a)
		endif
	enddo
end subroutine euc