let rec gcd n m =
  if m = 0 then n
  else gcd m (n mod m)
  
let () = Scanf.scanf "%d\n" @@ fun n ->
  let as_ = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun a -> a in
  let acc = Array.make (n + 1) 0 in
  let acc' = Array.make (n + 1) 0 in
  for i = 0 to n - 1 do
    acc.(i + 1) <- gcd acc.(i) as_.(i)
  done;
  for i = n - 1 downto 0 do
    acc'.(i) <- gcd acc'.(i + 1) as_.(i)
  done;
  Printf.printf "%d\n" @@
  Array.fold_left max min_int @@
  Array.init n @@ fun i -> gcd acc.(i) acc'.(i + 1)

