n = gets.to_i
a = gets.split.map(&:to_i).sort.reverse
dp = (n+1).times.map{[0]*2}

dp[0][0] = a[0]
dp[0][1] = a[1]

n.times{|i|
  dp[i+1][0] = a[i].gcd(dp[i][0])
  dp[i+1][1] = a[i].gcd(dp[i][1])
  dp[i+1][1] = dp[i][0] if dp[i+1][1] < dp[i][0]
}

p [dp[n][0],dp[n][1]].max
