read N
read -a A

min=1000000000
most_least=$min
pre_least=$min
for i in `seq 0 $(( N - 1 ))`; do
  if [ ${A[$i]} -lt $min ]; then
    min=${A[$i]}
  fi
done

for i in `seq 0 $(( N - 1 ))`; do
  m=${A[$i]}
  n=$min
  while [ $n -ne 0 ]; do
    n_old=$n
    n=$(( m % n ))
    m=$n_old
  done
  if [ $m -lt $most_least ]; then
    pre_least=$most_least
    most_least=$m
  elif [ $m -lt $pre_least ]; then
    pre_least=$m
  fi
done

echo $pre_least