(* O(n log(max a_s)) *)
let n = Scanf.scanf " %d" @@ (+) 0
let a_s = Array.init n @@ fun _ -> Scanf.scanf " %d" @@ (+) 0
let gcds = Array.make_matrix 2 (n + 1) 0
let rec gcd a b = if b = 0 then a else gcd b (a mod b)
let ans = ref 0
let _ =
  Array.iteri (fun i a -> gcds.(0).(i + 1) <- gcd gcds.(0).(i) a) a_s;
  Array.iteri (fun i a -> gcds.(1).(n - i - 1) <- gcd gcds.(1).(n - i) a_s.(n - i - 1)) a_s;
  for i = 0 to n - 1 do
    ans := max !ans @@ gcd gcds.(0).(i) gcds.(1).(i + 1)
  done;
  Printf.printf "%d\n" !ans