let rec gcd m n =
  if m = n then m
  else if m > n then gcd n m
  else gcd (n - m) m

let gcd_of_list ls = 
  let init = List.hd ls in
  List.fold_left (fun acc l -> gcd acc l) init ls

let solve n a =
  let rec inner acc i =
    if i = n - 1 then acc
    else 
      let tmp = ref [] in
      for j = 0 to n - 1 do
        if j <> i then tmp := a.(j)::!tmp;
      done;
      inner (max acc @@ gcd_of_list !tmp) (i + 1)
  in inner 0 0

let _ =
  let n = Scanf.scanf "%d\n" (fun n -> n) in
  let a = Array.make n 0 in
  for i = 0 to n - 1 do
    Scanf.scanf (if i <> n - 1 then "%d " else "%d\n") (fun a' -> a.(i) <- a')
  done;
  solve n a
  |> print_int
