#16D8101023J 久保田凌弥 kubotarouxxx python3

n=int(input())
A=[0]*n
for m in range(n):
 A[m]=int(input())

k=0
for i in range(n):
 for j in range(1,A[n-1]):
  if j==1:
   continue
  if j==(A[n-1]-1):
   k+=1
  if (A[i-1]%j)==0:
   break

print(j)

