$cache = {}
def gcd(a, b)
  key = [a,b]
  if $cache[key]
    $cache[key]
  else
    $cache[key] = if a < b
                    gcd(b, a)
                  elsif b == 0
                    a
                  else
                    gcd(b, a % b)
                  end
  end
end

def list_gcd(xs)
  xs.reduce { |acc, x|
    gcd(acc, x)
  }
end

def solve(a)
  (0 ... a.size).lazy.map { |i|
    copy = a.dup
    copy.delete_at(i)
    list_gcd(copy)
  }.max
end

def main
  n = gets.to_i
  a = gets.split.map(&:to_i)

  p solve(a)
end

main
