#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

/*
use std::collections::HashMap;

fn main() {
    let mut primes: Vec<i64> = vec![];
    let mut sieve = vec![true; 31623];

    for i in 2..sieve.len() {
        if sieve[i] {
            primes.push(i as i64);
            let mut j = i + i;
            while j < sieve.len() {
                sieve[j] = false;
                j += i;
            }
        }
    }

    input! {
        n: usize,
        a: [i64; n],
    }

    let mut m = HashMap::new();

    for a in a {
        let mut a = a;
        let mut fs = vec![];

        for &p in primes.iter() {
            if p * p > a {
                break;
            }

            let mut cnt = 0;
            while a % p == 0 {
                a /= p;
                cnt += 1;
            }
            if cnt > 0 {
                fs.push((p, cnt));
            }
        }

        if a > 1 {
            fs.push((a, 1));
        }

        // println!("{}: {:?}", a, fs);

        rec(0, 1, &fs, &mut m);
    }

    // println!("{:?}", m);

    let mut ans = 1;

    for (k, cnt) in m {
        if cnt >= n - 1 {
            ans = std::cmp::max(ans, k);
        }
    }

    println!("{}", ans);
}

fn rec(i: usize, acc: i64, fs: &[(i64, usize)], m: &mut HashMap<i64, usize>) {
    if i >= fs.len() {
        *m.entry(acc).or_insert(0) += 1;
        return;
    }

    let mut t = acc;
    for _ in 0..fs[i].1 + 1 {
        rec(i + 1, t, fs, m);
        t *= fs[i].0;
    }
}
*/

use std::cmp::max;

fn main() {
    input! {
        n: usize,
        a: [i64; n],
    }

    let f = |i| a.iter().filter(|&&a| a % i == 0).count();

    let mut ans = 1;
    for &a in a[0..2].iter() {
        for i in 1.. {
            if i * i > a {
                break;
            }
            if a % i == 0 {
                if f(i) >= n - 1 {
                    ans = max(ans, i);
                }
                if f(a / i) >= n - 1 {
                    ans = max(ans, a / i);
                }
            }
        }
    }

    println!("{}", ans);
}


Measured memory_bytes: 4352