type ABC(stream:System.IO.TextReader) =
  member this.Scan1 f = stream.ReadLine() |> f
  member this.ScanVecH f = stream.ReadLine().Split() |> Array.map f

let util = ABC(stdin)

let rec gcd a b =
  if b > a 
  then gcd b a
  else if b = 0 // 0とのGCDをこう定義しても通常のGCDに影響を与えない
  then a
  else match a % b with
       | 0 -> b
       | c -> gcd b c

let N = util.Scan1 int
let xs = util.ScanVecH int

let Ls = Array.scan gcd xs.[0] xs
let Rs = xs |> Array.rev |> Array.scan gcd xs.[N-1] |> Array.rev
Array.set Ls 0 0
Array.set Rs N 0

[0..N-1]
|> List.map (fun i -> gcd Ls.[i] Rs.[i+1])
|> List.max
|> printfn "%d"
