@file:Suppress("NOTHING_TO_INLINE", "EXPERIMENTAL_FEATURE_WARNING", "OVERRIDE_BY_INLINE")

import java.io.PrintWriter
import java.util.StringTokenizer
import kotlin.math.*
import kotlin.random.*
import kotlin.collections.sort as _sort
import kotlin.collections.sortDescending as _sortDescending
import kotlin.io.println as iprintln

/** @author Spheniscine */
fun main() {
    output {
        val n = readInt()
        val A = readLongArray(n)

        var ans = 1L

        val quota = (n+1)/2

        trial@ for(i in 0 until min(n, certainty)) {
            A.swap(i, random.nextInt(i, n))
            val ar = A[i]
            val D = ar.divisors().toList()
            val G = (0 until n).groupingBy { gcd(ar, A[it]) }.eachCount()

            for(d in D.asReversed()) {
                if(d <= ans) continue@trial
                var rem = quota
                for((g, cn) in G) {
                    if(g % d == 0L) {
                        rem -= cn
                        if(rem <= 0) {
                            ans = max(ans, d)
                            continue@trial
                        }
                    }
                }
            }
        }

        println(ans)
    }
}
const val certainty = 7 // probability of failure = 2^-n
fun LongArray.swap(i: Int, j: Int) { this[i] = this[j].also { this[j] = this[i] } }
fun Long.divisors() = sequence {
    val n = this@divisors
    if(n <= 0) return@sequence
    val tail = mutableListOf<Long>()

    for(p in 1..Long.MAX_VALUE) {
        val sq = p * p
        if(sq > n) break
        if(n % p == 0L) {
            yield(p)
            if(sq != n) tail.add(n / p)
        }
    }

    yieldAll(tail.asReversed())
}
tailrec fun gcd(a: Long, b: Long): Long = if(a == 0L) abs(b) else gcd(b % a, a)

/** IO code start */
//@JvmField val INPUT = File("input.txt").inputStream()
//@JvmField val OUTPUT = File("output.txt").outputStream()
@JvmField val INPUT = System.`in`
@JvmField val OUTPUT = System.out

@JvmField val _reader = INPUT.bufferedReader()
fun readLine(): String? = _reader.readLine()
fun readLn() = _reader.readLine()!!
@JvmField var _tokenizer: StringTokenizer = StringTokenizer("")
fun read(): String {
    while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return "", " ")
    return _tokenizer.nextToken()
}
fun readInt() = read().toInt()
fun readDouble() = read().toDouble()
fun readLong() = read().toLong()
fun readStrings(n: Int) = List(n) { read() }
fun readLines(n: Int) = List(n) { readLn() }
fun readInts(n: Int) = List(n) { read().toInt() }
fun readIntArray(n: Int) = IntArray(n) { read().toInt() }
fun readDoubles(n: Int) = List(n) { read().toDouble() }
fun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }
fun readLongs(n: Int) = List(n) { read().toLong() }
fun readLongArray(n: Int) = LongArray(n) { read().toLong() }

@JvmField val _writer = PrintWriter(OUTPUT, false)
inline fun output(block: PrintWriter.() -> Unit) { _writer.apply(block).flush() }

/** shuffles and sort overrides to avoid quicksort attacks */
private inline fun <R, V> R._shuffle(rnd: Random, get: R.(Int) -> V, set: R.(Int, V) -> Unit, size: Int) {
    // Fisher-Yates shuffle algorithm
    for (i in size - 1 downTo 1) {
        val j = rnd.nextInt(i + 1)
        val temp = get(i)
        set(i, get(j))
        set(j, temp)
    }
}

@JvmField var _random: Random? = null
val random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }

fun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, IntArray::get, IntArray::set, size)
fun IntArray.sort() { shuffle(); _sort() }
fun IntArray.sortDescending() { shuffle(); _sortDescending() }

fun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, LongArray::get, LongArray::set, size)
fun LongArray.sort() { shuffle(); _sort() }
fun LongArray.sortDescending() { shuffle(); _sortDescending() }

fun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, DoubleArray::get, DoubleArray::set, size)
fun DoubleArray.sort() { shuffle(); _sort() }
fun DoubleArray.sortDescending() { shuffle(); _sortDescending() }

fun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, CharArray::get, CharArray::set, size)
inline fun CharArray.sort() { _sort() }
inline fun CharArray.sortDescending() { _sortDescending() }

inline fun <T: Comparable<T>> Array<out T>.sort() = _sort()
inline fun <T: Comparable<T>> Array<out T>.sortDescending() = _sortDescending()
inline fun <T: Comparable<T>> MutableList<out T>.sort() = _sort()
inline fun <T: Comparable<T>> MutableList<out T>.sortDescending() = _sortDescending()

fun `please stop removing these imports IntelliJ`() {
    iprintln(max(1, 2))
}


@file:Suppress("NOTHING_TO_INLINE", "EXPERIMENTAL_FEATURE_WARNING", "OVERRIDE_BY_INLINE")

import java.io.PrintWriter
import java.util.StringTokenizer
import kotlin.math.*
import kotlin.random.Random
import kotlin.collections.sort as _sort
import kotlin.collections.sortDescending as _sortDescending
import kotlin.io.println as iprintln

/** @author Spheniscine */
fun main() { _writer.solve(); _writer.flush() }
fun PrintWriter.solve() {
    val startTime = System.nanoTime()
    val n = readInt()
    val A = readLongArray(n)

    var ans = 1L

    val quota = (n+1)/2

    val divisorMap = object {
        inline val capacity get() = 6720
        @JvmField var numDivisors = 0
        var bsBit = 0
        @JvmField val divisorsArr = LongArray(capacity)
        @JvmField val cnt = IntArray(capacity)

        fun loadDivisors(value: Long, downUntil: Long) {
            run {
                numDivisors = 0
                var tail_p = capacity

                for (p in 1..value) {
                    val sq = p * p
                    if (sq > value) break
                    val q = value / p
                    if (q * p == value) {
                        if (q <= downUntil) return@run
                        divisorsArr[numDivisors++] = q
                        if (sq != value && p > downUntil) divisorsArr[--tail_p] = p
                    }
                }

                for (i in tail_p until capacity) {
                    divisorsArr[numDivisors++] = divisorsArr[i]
                }
            }

            for(i in 0 until numDivisors) {
                cnt[i] = 0
            }

            bsBit = Integer.highestOneBit(numDivisors)
        }

        fun findIndex(d: Long): Int {
            var bit = bsBit
            var pos = 0

            while(bit > 0) {
                val npos = pos or bit
                if(npos <= numDivisors && divisorsArr[npos-1] > d) pos = npos
                bit = bit shr 1
            }
            return pos
        }

        fun incCnt(d: Long) { cnt[findIndex(d)]++ }

        inline fun forEachDivisor(action: (Long) -> Unit) {
            for(i in 0 until numDivisors) action(divisorsArr[i])
        }

        inline fun forEachEntry(action: (Long, Int) -> Unit) {
            for(i in 0 until numDivisors) action(divisorsArr[i], cnt[i])
        }
    }

    for(i in 0 until n/2 + 1) {
        if(System.nanoTime() - startTime > timeLimit) break
        A.swap(i, random.nextInt(i, n))
        val ar = A[i]
        divisorMap.loadDivisors(ar, ans)
        for(a in A) {
            val g = gcd(a, ar)
            if(g > ans) divisorMap.incCnt(g)
        }

        run trial@{
            divisorMap.forEachDivisor { d ->
                var rem = quota
                divisorMap.forEachEntry { g, cn ->
                    if (g < d) return@forEachDivisor
                    if (g % d == 0L) {
                        rem -= cn
                        if (rem <= 0) {
                            ans = d
                            return@trial
                        }
                    }
                }
            }
        }
    }

    println(ans)
}

const val timeLimit = 3.65e9.toLong()
inline fun LongArray.swap(i: Int, j: Int) { this[i] = this[j].also { this[j] = this[i] } }
tailrec fun gcd(a: Long, b: Long): Long = if(a == 0L) abs(b) else gcd(b % a, a)

/** IO code start */
//@JvmField val INPUT = File("input.txt").inputStream()
//@JvmField val OUTPUT = File("output.txt").outputStream()
@JvmField val INPUT = System.`in`
@JvmField val OUTPUT = System.out

@JvmField val _reader = INPUT.bufferedReader()
fun readLine(): String? = _reader.readLine()
fun readLn() = _reader.readLine()!!
@JvmField var _tokenizer: StringTokenizer = StringTokenizer("")
fun read(): String {
    while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return "", " ")
    return _tokenizer.nextToken()
}
fun readInt() = read().toInt()
fun readDouble() = read().toDouble()
fun readLong() = read().toLong()
fun readStrings(n: Int) = List(n) { read() }
fun readLines(n: Int) = List(n) { readLn() }
fun readInts(n: Int) = List(n) { read().toInt() }
fun readIntArray(n: Int) = IntArray(n) { read().toInt() }
fun readDoubles(n: Int) = List(n) { read().toDouble() }
fun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }
fun readLongs(n: Int) = List(n) { read().toLong() }
fun readLongArray(n: Int) = LongArray(n) { read().toLong() }

@JvmField val _writer = PrintWriter(OUTPUT, false)

/** shuffles and sort overrides to avoid quicksort attacks */
private inline fun <T> _shuffle(rnd: Random, get: (Int) -> T, set: (Int, T) -> Unit, size: Int) {
    // Fisher-Yates shuffle algorithm
    for (i in size - 1 downTo 1) {
        val j = rnd.nextInt(i + 1)
        val temp = get(i)
        set(i, get(j))
        set(j, temp)
    }
}

@JvmField var _random: Random? = null
val random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }

fun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
fun IntArray.sort() { shuffle(); _sort() }
fun IntArray.sortDescending() { shuffle(); _sortDescending() }

fun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
fun LongArray.sort() { shuffle(); _sort() }
fun LongArray.sortDescending() { shuffle(); _sortDescending() }

fun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
fun DoubleArray.sort() { shuffle(); _sort() }
fun DoubleArray.sortDescending() { shuffle(); _sortDescending() }

fun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
inline fun CharArray.sort() { _sort() }
inline fun CharArray.sortDescending() { _sortDescending() }

inline fun <T: Comparable<T>> Array<out T>.sort() = _sort()
inline fun <T: Comparable<T>> Array<out T>.sortDescending() = _sortDescending()
inline fun <T: Comparable<T>> MutableList<out T>.sort() = _sort()
inline fun <T: Comparable<T>> MutableList<out T>.sortDescending() = _sortDescending()

fun `please stop removing these imports IntelliJ`() {
    iprintln(max(1, 2))
}


@file:Suppress("NOTHING_TO_INLINE", "EXPERIMENTAL_FEATURE_WARNING", "OVERRIDE_BY_INLINE")

import java.io.PrintWriter
import java.util.StringTokenizer
import kotlin.math.*
import kotlin.random.*
import kotlin.collections.sort as _sort
import kotlin.collections.sortDescending as _sortDescending
import kotlin.io.println as iprintln

/** @author Spheniscine */
fun main() {
    output {
        val n = readInt()
        val A = readLongArray(n)

        var ans = 1L

        val quota = (n+1)/2

        trial@ for(i in 0 until min(n, certainty)) {
            A.swap(i, random.nextInt(i, n))
            val ar = A[i]
            val D = ar.divisors().toList()
            val G = (0 until n).groupingBy { gcd(ar, A[it]) }.eachCount().asIterable()
                .sortedByDescending { it.key }

            d@ for(d in D.asReversed()) {
                if(d <= ans) continue@trial
                var rem = quota
                for((g, cn) in G) {
                    if(g < d) continue@d
                    if(g % d == 0L) {
                        rem -= cn
                        if(rem <= 0) {
                            ans = d
                            continue@trial
                        }
                    }
                }
            }
        }

        println(ans)
    }
}
const val certainty = 7 // probability of failure = 2^-n
fun LongArray.swap(i: Int, j: Int) { this[i] = this[j].also { this[j] = this[i] } }
fun Long.divisors() = sequence {
    val n = this@divisors
    if(n <= 0) return@sequence
    val tail = mutableListOf<Long>()

    for(p in 1..Long.MAX_VALUE) {
        val sq = p * p
        if(sq > n) break
        if(n % p == 0L) {
            yield(p)
            if(sq != n) tail.add(n / p)
        }
    }

    yieldAll(tail.asReversed())
}
tailrec fun gcd(a: Long, b: Long): Long = if(a == 0L) abs(b) else gcd(b % a, a)

/** IO code start */
//@JvmField val INPUT = File("input.txt").inputStream()
//@JvmField val OUTPUT = File("output.txt").outputStream()
@JvmField val INPUT = System.`in`
@JvmField val OUTPUT = System.out

@JvmField val _reader = INPUT.bufferedReader()
fun readLine(): String? = _reader.readLine()
fun readLn() = _reader.readLine()!!
@JvmField var _tokenizer: StringTokenizer = StringTokenizer("")
fun read(): String {
    while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return "", " ")
    return _tokenizer.nextToken()
}
fun readInt() = read().toInt()
fun readDouble() = read().toDouble()
fun readLong() = read().toLong()
fun readStrings(n: Int) = List(n) { read() }
fun readLines(n: Int) = List(n) { readLn() }
fun readInts(n: Int) = List(n) { read().toInt() }
fun readIntArray(n: Int) = IntArray(n) { read().toInt() }
fun readDoubles(n: Int) = List(n) { read().toDouble() }
fun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }
fun readLongs(n: Int) = List(n) { read().toLong() }
fun readLongArray(n: Int) = LongArray(n) { read().toLong() }

@JvmField val _writer = PrintWriter(OUTPUT, false)
inline fun output(block: PrintWriter.() -> Unit) { _writer.apply(block).flush() }

/** shuffles and sort overrides to avoid quicksort attacks */
private inline fun <R, V> R._shuffle(rnd: Random, get: R.(Int) -> V, set: R.(Int, V) -> Unit, size: Int) {
    // Fisher-Yates shuffle algorithm
    for (i in size - 1 downTo 1) {
        val j = rnd.nextInt(i + 1)
        val temp = get(i)
        set(i, get(j))
        set(j, temp)
    }
}

@JvmField var _random: Random? = null
val random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }

fun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, IntArray::get, IntArray::set, size)
fun IntArray.sort() { shuffle(); _sort() }
fun IntArray.sortDescending() { shuffle(); _sortDescending() }

fun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, LongArray::get, LongArray::set, size)
fun LongArray.sort() { shuffle(); _sort() }
fun LongArray.sortDescending() { shuffle(); _sortDescending() }

fun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, DoubleArray::get, DoubleArray::set, size)
fun DoubleArray.sort() { shuffle(); _sort() }
fun DoubleArray.sortDescending() { shuffle(); _sortDescending() }

fun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, CharArray::get, CharArray::set, size)
inline fun CharArray.sort() { _sort() }
inline fun CharArray.sortDescending() { _sortDescending() }

inline fun <T: Comparable<T>> Array<out T>.sort() = _sort()
inline fun <T: Comparable<T>> Array<out T>.sortDescending() = _sortDescending()
inline fun <T: Comparable<T>> MutableList<out T>.sort() = _sort()
inline fun <T: Comparable<T>> MutableList<out T>.sortDescending() = _sortDescending()

fun `please stop removing these imports IntelliJ`() {
    iprintln(max(1, 2))
}


@file:Suppress("NOTHING_TO_INLINE", "EXPERIMENTAL_FEATURE_WARNING", "OVERRIDE_BY_INLINE")

import java.io.PrintWriter
import java.util.StringTokenizer
import kotlin.math.*
import kotlin.random.*
import kotlin.collections.sort as _sort
import kotlin.collections.sortDescending as _sortDescending
import kotlin.io.println as iprintln

/** @author Spheniscine */
fun main() {
    output {
        val n = readInt()
        val A = readLongArray(n)

        var ans = 1L

        val quota = (n+1)/2

        trial@ for(i in 0 until min(n, certainty)) {
            A.swap(i, random.nextInt(i, n))
            val ar = A[i]
            val D = ar.divisors().toList()
            val G = (0 until n).groupingBy { gcd(ar, A[it]) }.eachCount()

            for(d in D.asReversed()) {
                var rem = quota
                for((g, cn) in G) {
                    if(g % d == 0L) {
                        rem -= cn
                        if(rem <= 0) {
                            ans = max(ans, d)
                            continue@trial
                        }
                    }
                }
            }
        }

        println(ans)
    }
}
const val certainty = 40 // probability of failure = 2^-n
fun LongArray.swap(i: Int, j: Int) { this[i] = this[j].also { this[j] = this[i] } }
fun Long.divisors() = sequence {
    val n = this@divisors
    if(n <= 0) return@sequence
    val tail = mutableListOf<Long>()

    for(p in 1..Long.MAX_VALUE) {
        val sq = p * p
        if(sq > n) break
        if(n % p == 0L) {
            yield(p)
            if(sq != n) tail.add(n / p)
        }
    }

    yieldAll(tail.asReversed())
}
tailrec fun gcd(a: Long, b: Long): Long = if(a == 0L) abs(b) else gcd(b % a, a)

/** IO code start */
//@JvmField val INPUT = File("input.txt").inputStream()
//@JvmField val OUTPUT = File("output.txt").outputStream()
@JvmField val INPUT = System.`in`
@JvmField val OUTPUT = System.out

@JvmField val _reader = INPUT.bufferedReader()
fun readLine(): String? = _reader.readLine()
fun readLn() = _reader.readLine()!!
@JvmField var _tokenizer: StringTokenizer = StringTokenizer("")
fun read(): String {
    while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return "", " ")
    return _tokenizer.nextToken()
}
fun readInt() = read().toInt()
fun readDouble() = read().toDouble()
fun readLong() = read().toLong()
fun readStrings(n: Int) = List(n) { read() }
fun readLines(n: Int) = List(n) { readLn() }
fun readInts(n: Int) = List(n) { read().toInt() }
fun readIntArray(n: Int) = IntArray(n) { read().toInt() }
fun readDoubles(n: Int) = List(n) { read().toDouble() }
fun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }
fun readLongs(n: Int) = List(n) { read().toLong() }
fun readLongArray(n: Int) = LongArray(n) { read().toLong() }

@JvmField val _writer = PrintWriter(OUTPUT, false)
inline fun output(block: PrintWriter.() -> Unit) { _writer.apply(block).flush() }

/** shuffles and sort overrides to avoid quicksort attacks */
private inline fun <R, V> R._shuffle(rnd: Random, get: R.(Int) -> V, set: R.(Int, V) -> Unit, size: Int) {
    // Fisher-Yates shuffle algorithm
    for (i in size - 1 downTo 1) {
        val j = rnd.nextInt(i + 1)
        val temp = get(i)
        set(i, get(j))
        set(j, temp)
    }
}

@JvmField var _random: Random? = null
val random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }

fun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, IntArray::get, IntArray::set, size)
fun IntArray.sort() { shuffle(); _sort() }
fun IntArray.sortDescending() { shuffle(); _sortDescending() }

fun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, LongArray::get, LongArray::set, size)
fun LongArray.sort() { shuffle(); _sort() }
fun LongArray.sortDescending() { shuffle(); _sortDescending() }

fun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, DoubleArray::get, DoubleArray::set, size)
fun DoubleArray.sort() { shuffle(); _sort() }
fun DoubleArray.sortDescending() { shuffle(); _sortDescending() }

fun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, CharArray::get, CharArray::set, size)
inline fun CharArray.sort() { _sort() }
inline fun CharArray.sortDescending() { _sortDescending() }

inline fun <T: Comparable<T>> Array<out T>.sort() = _sort()
inline fun <T: Comparable<T>> Array<out T>.sortDescending() = _sortDescending()
inline fun <T: Comparable<T>> MutableList<out T>.sort() = _sort()
inline fun <T: Comparable<T>> MutableList<out T>.sortDescending() = _sortDescending()

fun `please stop removing these imports IntelliJ`() {
    iprintln(max(1, 2))
}


@file:Suppress("NOTHING_TO_INLINE", "EXPERIMENTAL_FEATURE_WARNING", "OVERRIDE_BY_INLINE")

import java.io.PrintWriter
import java.util.StringTokenizer
import kotlin.math.*
import kotlin.random.*
import kotlin.collections.sort as _sort
import kotlin.collections.sortDescending as _sortDescending
import kotlin.io.println as iprintln

/** @author Spheniscine */
fun main() {
    output {
        val n = readInt()
        val A = readLongArray(n)

        var ans = 1L

        val quota = (n+1)/2

        val divTail = LongArray(1e6.toInt())

         for(i in 0 until min(n, certainty)) {
            A.swap(i, random.nextInt(i, n))
            val ar = A[i]
            val G = (0 until n).groupingBy { gcd(ar, A[it]) }.eachCount().asIterable()
                .sortedByDescending { it.key }

             run trial@{
                ar.forEachDivisorDesc(divTail) { d ->
                    if (d <= ans) return@trial
                    var rem = quota
                    for ((g, cn) in G) {
                        if (g < d) return@forEachDivisorDesc
                        if (g % d == 0L) {
                            rem -= cn
                            if (rem <= 0) {
                                ans = d
                                return@trial
                            }
                        }
                    }
                }
            }
        }

        println(ans)
    }
}
const val certainty = 10 // probability of failure = 2^-n
fun LongArray.swap(i: Int, j: Int) { this[i] = this[j].also { this[j] = this[i] } }
inline fun Long.forEachDivisorDesc(divTail: LongArray, action: (Long) -> Unit)  {
    var tail_p = -1

    for(p in 1..this) {
        val sq = p * p
        if(sq > this) break
        if(this % p == 0L) {
            action(this / p)
            if(sq != this) divTail[++tail_p] = p
        }
    }

    for(i in tail_p downTo 0) action(divTail[i])
}
tailrec fun gcd(a: Long, b: Long): Long = if(a == 0L) abs(b) else gcd(b % a, a)

/** IO code start */
//@JvmField val INPUT = File("input.txt").inputStream()
//@JvmField val OUTPUT = File("output.txt").outputStream()
@JvmField val INPUT = System.`in`
@JvmField val OUTPUT = System.out

@JvmField val _reader = INPUT.bufferedReader()
fun readLine(): String? = _reader.readLine()
fun readLn() = _reader.readLine()!!
@JvmField var _tokenizer: StringTokenizer = StringTokenizer("")
fun read(): String {
    while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return "", " ")
    return _tokenizer.nextToken()
}
fun readInt() = read().toInt()
fun readDouble() = read().toDouble()
fun readLong() = read().toLong()
fun readStrings(n: Int) = List(n) { read() }
fun readLines(n: Int) = List(n) { readLn() }
fun readInts(n: Int) = List(n) { read().toInt() }
fun readIntArray(n: Int) = IntArray(n) { read().toInt() }
fun readDoubles(n: Int) = List(n) { read().toDouble() }
fun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }
fun readLongs(n: Int) = List(n) { read().toLong() }
fun readLongArray(n: Int) = LongArray(n) { read().toLong() }

@JvmField val _writer = PrintWriter(OUTPUT, false)
inline fun output(block: PrintWriter.() -> Unit) { _writer.apply(block).flush() }

/** shuffles and sort overrides to avoid quicksort attacks */
private inline fun <R, V> R._shuffle(rnd: Random, get: R.(Int) -> V, set: R.(Int, V) -> Unit, size: Int) {
    // Fisher-Yates shuffle algorithm
    for (i in size - 1 downTo 1) {
        val j = rnd.nextInt(i + 1)
        val temp = get(i)
        set(i, get(j))
        set(j, temp)
    }
}

@JvmField var _random: Random? = null
val random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }

fun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, IntArray::get, IntArray::set, size)
fun IntArray.sort() { shuffle(); _sort() }
fun IntArray.sortDescending() { shuffle(); _sortDescending() }

fun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, LongArray::get, LongArray::set, size)
fun LongArray.sort() { shuffle(); _sort() }
fun LongArray.sortDescending() { shuffle(); _sortDescending() }

fun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, DoubleArray::get, DoubleArray::set, size)
fun DoubleArray.sort() { shuffle(); _sort() }
fun DoubleArray.sortDescending() { shuffle(); _sortDescending() }

fun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, CharArray::get, CharArray::set, size)
inline fun CharArray.sort() { _sort() }
inline fun CharArray.sortDescending() { _sortDescending() }

inline fun <T: Comparable<T>> Array<out T>.sort() = _sort()
inline fun <T: Comparable<T>> Array<out T>.sortDescending() = _sortDescending()
inline fun <T: Comparable<T>> MutableList<out T>.sort() = _sort()
inline fun <T: Comparable<T>> MutableList<out T>.sortDescending() = _sortDescending()

fun `please stop removing these imports IntelliJ`() {
    iprintln(max(1, 2))
}


@file:Suppress("NOTHING_TO_INLINE", "EXPERIMENTAL_FEATURE_WARNING", "OVERRIDE_BY_INLINE")

import java.io.PrintWriter
import java.util.StringTokenizer
import kotlin.math.*
import kotlin.random.*
import kotlin.collections.sort as _sort
import kotlin.collections.sortDescending as _sortDescending
import kotlin.io.println as iprintln

/** @author Spheniscine */
fun main() {
    output {
        val n = readInt()
        val A = readLongArray(n)

        var ans = 1L

        val quota = (n+1)/2

        trial@ for(i in 0 until min(n, certainty)) {
            A.swap(i, random.nextInt(i, n))
            val ar = A[i]
            val cnt = mutableMapOf<Long, Int>()
            for(d in ar.divisorsReversed().takeWhile { it > ans }) cnt[d] = 0
            for(a in A) {
                val g = gcd(ar, a)
                if(g > ans) cnt[g] = cnt[g]!! + 1
            }

            val ite = cnt.iterator()
            for((d, cn) in ite) {
                if(cn >= quota) {
                    ans = d
                    break@trial
                }
                ite.remove()
                for(d2 in cnt.keys) {
                    if(d % d2 == 0L) cnt[d2] = cnt[d2]!! + cn
                }
            }
        }

        println(ans)
    }
}
const val certainty = 30 // probability of failure = 2^-n
fun LongArray.swap(i: Int, j: Int) { this[i] = this[j].also { this[j] = this[i] } }
fun Long.divisorsReversed() = sequence {
    val n = this@divisorsReversed
    if(n <= 0) return@sequence
    val head = mutableListOf<Long>()

    for(p in 1..Long.MAX_VALUE) {
        val sq = p * p
        if(sq > n) break
        if(n % p == 0L) {
            head.add(p)
            if(sq != n) yield(n / p)
        }
    }

    yieldAll(head.asReversed())
}
tailrec fun gcd(a: Long, b: Long): Long = if(a == 0L) abs(b) else gcd(b % a, a)

/** IO code start */
//@JvmField val INPUT = File("input.txt").inputStream()
//@JvmField val OUTPUT = File("output.txt").outputStream()
@JvmField val INPUT = System.`in`
@JvmField val OUTPUT = System.out

@JvmField val _reader = INPUT.bufferedReader()
fun readLine(): String? = _reader.readLine()
fun readLn() = _reader.readLine()!!
@JvmField var _tokenizer: StringTokenizer = StringTokenizer("")
fun read(): String {
    while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return "", " ")
    return _tokenizer.nextToken()
}
fun readInt() = read().toInt()
fun readDouble() = read().toDouble()
fun readLong() = read().toLong()
fun readStrings(n: Int) = List(n) { read() }
fun readLines(n: Int) = List(n) { readLn() }
fun readInts(n: Int) = List(n) { read().toInt() }
fun readIntArray(n: Int) = IntArray(n) { read().toInt() }
fun readDoubles(n: Int) = List(n) { read().toDouble() }
fun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }
fun readLongs(n: Int) = List(n) { read().toLong() }
fun readLongArray(n: Int) = LongArray(n) { read().toLong() }

@JvmField val _writer = PrintWriter(OUTPUT, false)
inline fun output(block: PrintWriter.() -> Unit) { _writer.apply(block).flush() }

/** shuffles and sort overrides to avoid quicksort attacks */
private inline fun <R, V> R._shuffle(rnd: Random, get: R.(Int) -> V, set: R.(Int, V) -> Unit, size: Int) {
    // Fisher-Yates shuffle algorithm
    for (i in size - 1 downTo 1) {
        val j = rnd.nextInt(i + 1)
        val temp = get(i)
        set(i, get(j))
        set(j, temp)
    }
}

@JvmField var _random: Random? = null
val random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }

fun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, IntArray::get, IntArray::set, size)
fun IntArray.sort() { shuffle(); _sort() }
fun IntArray.sortDescending() { shuffle(); _sortDescending() }

fun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, LongArray::get, LongArray::set, size)
fun LongArray.sort() { shuffle(); _sort() }
fun LongArray.sortDescending() { shuffle(); _sortDescending() }

fun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, DoubleArray::get, DoubleArray::set, size)
fun DoubleArray.sort() { shuffle(); _sort() }
fun DoubleArray.sortDescending() { shuffle(); _sortDescending() }

fun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, CharArray::get, CharArray::set, size)
inline fun CharArray.sort() { _sort() }
inline fun CharArray.sortDescending() { _sortDescending() }

inline fun <T: Comparable<T>> Array<out T>.sort() = _sort()
inline fun <T: Comparable<T>> Array<out T>.sortDescending() = _sortDescending()
inline fun <T: Comparable<T>> MutableList<out T>.sort() = _sort()
inline fun <T: Comparable<T>> MutableList<out T>.sortDescending() = _sortDescending()

fun `please stop removing these imports IntelliJ`() {
    iprintln(max(1, 2))
}


@file:Suppress("NOTHING_TO_INLINE", "EXPERIMENTAL_FEATURE_WARNING", "OVERRIDE_BY_INLINE")

import java.io.PrintWriter
import java.util.StringTokenizer
import kotlin.math.*
import kotlin.random.*
import kotlin.collections.sort as _sort
import kotlin.collections.sortDescending as _sortDescending
import kotlin.io.println as iprintln

/** @author Spheniscine */
fun main() {
    //output {
        val startTime = System.nanoTime()
        val n = readInt()
        val A = readLongArray(n)

        var ans = 1L

        val quota = (n+1)/2

        val divisorMap = object {
            inline val capacity get() = 6720
            var numDivisors = 0
            val divisorsArr = LongArray(capacity)
            val cnt = IntArray(capacity)

            fun loadDivisors(value: Long, downUntil: Long) {
                run {
                    numDivisors = 0
                    var tail_p = capacity

                    for (p in 1..value) {
                        val sq = p * p
                        if (sq > value) break
                        if (value % p == 0L) {
                            val q = value / p
                            if (q <= downUntil) return@run
                            divisorsArr[numDivisors++] = q
                            if (sq != value && p > downUntil) divisorsArr[--tail_p] = p
                        }
                    }

                    for (i in tail_p until capacity) {
                        divisorsArr[numDivisors++] = divisorsArr[i]
                    }
                }

                for(i in 0 until numDivisors) {
                    cnt[i] = 0
                }
            }

            fun findIndex(d: Long): Int {
                var low = 0
                var high = numDivisors - 1

                while (low <= high) {
                    val mid = (low + high) shr 1
                    val cmp = d.compareTo(divisorsArr[mid])

                    when {
                        cmp < 0 -> low = mid + 1
                        cmp > 0 -> high = mid - 1
                        else -> return mid
                    }
                }
                return -1
            }

            fun incCnt(d: Long) { cnt[findIndex(d)]++ }

            inline fun forEachDivisor(action: (Long) -> Unit) {
                for(i in 0 until numDivisors) action(divisorsArr[i])
            }

            inline fun forEachEntry(action: (Long, Int) -> Unit) {
                for(i in 0 until numDivisors) action(divisorsArr[i], cnt[i])
            }
        }

        for(i in 0 until n/2 + 1) {
            if(System.nanoTime() - startTime > timeLimit) break
            A.swap(i, random.nextInt(i, n))
            val ar = A[i]
            divisorMap.loadDivisors(ar, ans)
            for(a in A) {
                val g = gcd(a, ar)
                if(g > ans) divisorMap.incCnt(g)
            }

            run trial@{
                divisorMap.forEachDivisor { d ->
                    var rem = quota
                    divisorMap.forEachEntry { g, cn ->
                        if (g < d) return@forEachDivisor
                        if (g % d == 0L) {
                            rem -= cn
                            if (rem <= 0) {
                                ans = d
                                return@trial
                            }
                        }
                    }
                }
            }
        }

        iprintln(ans)
    //}
}
const val timeLimit = 3.65e9.toLong()
inline fun LongArray.swap(i: Int, j: Int) { this[i] = this[j].also { this[j] = this[i] } }
tailrec fun gcd(a: Long, b: Long): Long = if(a == 0L) abs(b) else gcd(b % a, a)

/** IO code start */
//@JvmField val INPUT = File("input.txt").inputStream()
//@JvmField val OUTPUT = File("output.txt").outputStream()
@JvmField val INPUT = System.`in`
@JvmField val OUTPUT = System.out

@JvmField val _reader = INPUT.bufferedReader()
fun readLine(): String? = _reader.readLine()
fun readLn() = _reader.readLine()!!
@JvmField var _tokenizer: StringTokenizer = StringTokenizer("")
fun read(): String {
    while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return "", " ")
    return _tokenizer.nextToken()
}
fun readInt() = read().toInt()
fun readDouble() = read().toDouble()
fun readLong() = read().toLong()
fun readStrings(n: Int) = List(n) { read() }
fun readLines(n: Int) = List(n) { readLn() }
fun readInts(n: Int) = List(n) { read().toInt() }
fun readIntArray(n: Int) = IntArray(n) { read().toInt() }
fun readDoubles(n: Int) = List(n) { read().toDouble() }
fun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }
fun readLongs(n: Int) = List(n) { read().toLong() }
fun readLongArray(n: Int) = LongArray(n) { read().toLong() }

@JvmField val _writer = PrintWriter(OUTPUT, false)
inline fun output(block: PrintWriter.() -> Unit) { _writer.apply(block).flush() }

/** shuffles and sort overrides to avoid quicksort attacks */
private inline fun <R, V> R._shuffle(rnd: Random, get: R.(Int) -> V, set: R.(Int, V) -> Unit, size: Int) {
    // Fisher-Yates shuffle algorithm
    for (i in size - 1 downTo 1) {
        val j = rnd.nextInt(i + 1)
        val temp = get(i)
        set(i, get(j))
        set(j, temp)
    }
}

@JvmField var _random: Random? = null
val random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }

fun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, IntArray::get, IntArray::set, size)
fun IntArray.sort() { shuffle(); _sort() }
fun IntArray.sortDescending() { shuffle(); _sortDescending() }

fun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, LongArray::get, LongArray::set, size)
fun LongArray.sort() { shuffle(); _sort() }
fun LongArray.sortDescending() { shuffle(); _sortDescending() }

fun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, DoubleArray::get, DoubleArray::set, size)
fun DoubleArray.sort() { shuffle(); _sort() }
fun DoubleArray.sortDescending() { shuffle(); _sortDescending() }

fun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, CharArray::get, CharArray::set, size)
inline fun CharArray.sort() { _sort() }
inline fun CharArray.sortDescending() { _sortDescending() }

inline fun <T: Comparable<T>> Array<out T>.sort() = _sort()
inline fun <T: Comparable<T>> Array<out T>.sortDescending() = _sortDescending()
inline fun <T: Comparable<T>> MutableList<out T>.sort() = _sort()
inline fun <T: Comparable<T>> MutableList<out T>.sortDescending() = _sortDescending()

fun `please stop removing these imports IntelliJ`() {
    iprintln(max(1, 2))
}


@file:Suppress("NOTHING_TO_INLINE", "EXPERIMENTAL_FEATURE_WARNING", "OVERRIDE_BY_INLINE")

import java.io.PrintWriter
import java.util.StringTokenizer
import kotlin.math.*
import kotlin.random.Random
import kotlin.collections.sort as _sort
import kotlin.collections.sortDescending as _sortDescending
import kotlin.io.println as iprintln

/** @author Spheniscine */
fun main() { _writer.solve(); _writer.flush() }
fun PrintWriter.solve() {
    val startTime = System.nanoTime()
    val n = readInt()
    val A = readLongArray(n)

    var ans = 1L

    val quota = (n+1)/2

    val divisorMap = object {
        inline val capacity get() = 6720
        var numDivisors = 0
        var bsBit = 0
        val divisorsArr = LongArray(capacity)
        val cnt = IntArray(capacity)

        fun loadDivisors(value: Long, downUntil: Long) {
            run {
                numDivisors = 0
                var tail_p = capacity

                for (p in 1..value) {
                    val sq = p * p
                    if (sq > value) break
                    val q = value / p
                    if (q * p == value) {
                        if (q <= downUntil) return@run
                        divisorsArr[numDivisors++] = q
                        if (sq != value && p > downUntil) divisorsArr[--tail_p] = p
                    }
                }

                for (i in tail_p until capacity) {
                    divisorsArr[numDivisors++] = divisorsArr[i]
                }
            }

            for(i in 0 until numDivisors) {
                cnt[i] = 0
            }

            bsBit = Integer.highestOneBit(numDivisors)
        }

        fun findIndex(d: Long): Int {
            var bit = bsBit
            var pos = 0

            while(bit > 0) {
                val npos = pos or bit
                if(npos <= numDivisors && divisorsArr[npos-1] > d) pos = npos
                bit = bit shr 1
            }
            return pos
        }

        fun incCnt(d: Long) { cnt[findIndex(d)]++ }

        inline fun forEachDivisor(action: (Long) -> Unit) {
            for(i in 0 until numDivisors) action(divisorsArr[i])
        }

        inline fun forEachEntry(action: (Long, Int) -> Unit) {
            for(i in 0 until numDivisors) action(divisorsArr[i], cnt[i])
        }
    }

    for(i in 0 until n/2 + 1) {
        //if(System.nanoTime() - startTime > timeLimit) break
        A.swap(i, random.nextInt(i, n))
        val ar = A[i]
        divisorMap.loadDivisors(ar, ans)
        for(a in A) {
            val g = gcd(a, ar)
            if(g > ans) divisorMap.incCnt(g)
        }

        run trial@{
            divisorMap.forEachDivisor { d ->
                var rem = quota
                divisorMap.forEachEntry { g, cn ->
                    if (g < d) return@forEachDivisor
                    if (g % d == 0L) {
                        rem -= cn
                        if (rem <= 0) {
                            ans = d
                            return@trial
                        }
                    }
                }
            }
        }
    }

    println(ans)
}

const val timeLimit = 3.7e9.toLong()
inline fun LongArray.swap(i: Int, j: Int) { this[i] = this[j].also { this[j] = this[i] } }
tailrec fun gcd(a: Long, b: Long): Long = if(a == 0L) abs(b) else gcd(b % a, a)

/** IO code start */
//@JvmField val INPUT = File("input.txt").inputStream()
//@JvmField val OUTPUT = File("output.txt").outputStream()
@JvmField val INPUT = System.`in`
@JvmField val OUTPUT = System.out

@JvmField val _reader = INPUT.bufferedReader()
fun readLine(): String? = _reader.readLine()
fun readLn() = _reader.readLine()!!
@JvmField var _tokenizer: StringTokenizer = StringTokenizer("")
fun read(): String {
    while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return "", " ")
    return _tokenizer.nextToken()
}
fun readInt() = read().toInt()
fun readDouble() = read().toDouble()
fun readLong() = read().toLong()
fun readStrings(n: Int) = List(n) { read() }
fun readLines(n: Int) = List(n) { readLn() }
fun readInts(n: Int) = List(n) { read().toInt() }
fun readIntArray(n: Int) = IntArray(n) { read().toInt() }
fun readDoubles(n: Int) = List(n) { read().toDouble() }
fun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }
fun readLongs(n: Int) = List(n) { read().toLong() }
fun readLongArray(n: Int) = LongArray(n) { read().toLong() }

@JvmField val _writer = PrintWriter(OUTPUT, false)

/** shuffles and sort overrides to avoid quicksort attacks */
private inline fun <T> _shuffle(rnd: Random, get: (Int) -> T, set: (Int, T) -> Unit, size: Int) {
    // Fisher-Yates shuffle algorithm
    for (i in size - 1 downTo 1) {
        val j = rnd.nextInt(i + 1)
        val temp = get(i)
        set(i, get(j))
        set(j, temp)
    }
}

@JvmField var _random: Random? = null
val random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }

fun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
fun IntArray.sort() { shuffle(); _sort() }
fun IntArray.sortDescending() { shuffle(); _sortDescending() }

fun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
fun LongArray.sort() { shuffle(); _sort() }
fun LongArray.sortDescending() { shuffle(); _sortDescending() }

fun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
fun DoubleArray.sort() { shuffle(); _sort() }
fun DoubleArray.sortDescending() { shuffle(); _sortDescending() }

fun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
inline fun CharArray.sort() { _sort() }
inline fun CharArray.sortDescending() { _sortDescending() }

inline fun <T: Comparable<T>> Array<out T>.sort() = _sort()
inline fun <T: Comparable<T>> Array<out T>.sortDescending() = _sortDescending()
inline fun <T: Comparable<T>> MutableList<out T>.sort() = _sort()
inline fun <T: Comparable<T>> MutableList<out T>.sortDescending() = _sortDescending()

fun `please stop removing these imports IntelliJ`() {
    iprintln(max(1, 2))
}


@file:Suppress("NOTHING_TO_INLINE", "EXPERIMENTAL_FEATURE_WARNING", "OVERRIDE_BY_INLINE")

import java.io.PrintWriter
import java.util.StringTokenizer
import kotlin.math.*
import kotlin.random.*
import kotlin.collections.sort as _sort
import kotlin.collections.sortDescending as _sortDescending
import kotlin.io.println as iprintln

/** @author Spheniscine */
fun main() {
    //output {
        val startTime = System.nanoTime()
        val n = readInt()
        val A = readLongArray(n)

        var ans = 1L

        val quota = (n+1)/2

        val divisorMap = object {
            inline val capacity get() = 6720
            var numDivisors = 0
            val divisorsArr = LongArray(capacity)
            val cnt = IntArray(capacity)

            fun loadDivisors(value: Long, downUntil: Long) {
                run {
                    numDivisors = 0
                    var tail_p = capacity

                    for (p in 1..value) {
                        val sq = p * p
                        if (sq > value) break
                        if (value % p == 0L) {
                            val q = value / p
                            if (q <= downUntil) return@run
                            divisorsArr[numDivisors++] = q
                            if (sq != value && p > downUntil) divisorsArr[--tail_p] = p
                        }
                    }

                    for (i in tail_p until capacity) {
                        divisorsArr[numDivisors++] = divisorsArr[i]
                    }
                }

                for(i in 0 until numDivisors) {
                    cnt[i] = 0
                }
            }

            fun findIndex(d: Long): Int {
                var low = 0
                var high = numDivisors - 1

                while (low <= high) {
                    val mid = (low + high) shr 1
                    val cmp = d.compareTo(divisorsArr[mid])

                    when {
                        cmp < 0 -> low = mid + 1
                        cmp > 0 -> high = mid - 1
                        else -> return mid
                    }
                }
                return -1
            }

            fun incCnt(d: Long) { cnt[findIndex(d)]++ }

            inline fun forEachDivisor(action: (Long) -> Unit) {
                for(i in 0 until numDivisors) action(divisorsArr[i])
            }

            inline fun forEachEntry(action: (Long, Int) -> Unit) {
                for(i in 0 until numDivisors) action(divisorsArr[i], cnt[i])
            }
        }

        for(i in 0 until quota) {
            if(System.nanoTime() - startTime > timeLimit) break
            A.swap(i, random.nextInt(i, n))
            val ar = A[i]
            divisorMap.loadDivisors(ar, ans)
            for(a in A) {
                val g = gcd(a, ar)
                if(g > ans) divisorMap.incCnt(g)
            }

            run trial@{
                divisorMap.forEachDivisor { d ->
                    var rem = quota
                    divisorMap.forEachEntry { g, cn ->
                        if (g < d) return@forEachDivisor
                        if (g % d == 0L) {
                            rem -= cn
                            if (rem <= 0) {
                                ans = d
                                return@trial
                            }
                        }
                    }
                }
            }
        }

        iprintln(ans)
    //}
}
const val timeLimit = 3.65e9.toLong()
inline fun LongArray.swap(i: Int, j: Int) { this[i] = this[j].also { this[j] = this[i] } }
tailrec fun gcd(a: Long, b: Long): Long = if(a == 0L) abs(b) else gcd(b % a, a)

/** IO code start */
//@JvmField val INPUT = File("input.txt").inputStream()
//@JvmField val OUTPUT = File("output.txt").outputStream()
@JvmField val INPUT = System.`in`
@JvmField val OUTPUT = System.out

@JvmField val _reader = INPUT.bufferedReader()
fun readLine(): String? = _reader.readLine()
fun readLn() = _reader.readLine()!!
@JvmField var _tokenizer: StringTokenizer = StringTokenizer("")
fun read(): String {
    while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return "", " ")
    return _tokenizer.nextToken()
}
fun readInt() = read().toInt()
fun readDouble() = read().toDouble()
fun readLong() = read().toLong()
fun readStrings(n: Int) = List(n) { read() }
fun readLines(n: Int) = List(n) { readLn() }
fun readInts(n: Int) = List(n) { read().toInt() }
fun readIntArray(n: Int) = IntArray(n) { read().toInt() }
fun readDoubles(n: Int) = List(n) { read().toDouble() }
fun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }
fun readLongs(n: Int) = List(n) { read().toLong() }
fun readLongArray(n: Int) = LongArray(n) { read().toLong() }

@JvmField val _writer = PrintWriter(OUTPUT, false)
inline fun output(block: PrintWriter.() -> Unit) { _writer.apply(block).flush() }

/** shuffles and sort overrides to avoid quicksort attacks */
private inline fun <R, V> R._shuffle(rnd: Random, get: R.(Int) -> V, set: R.(Int, V) -> Unit, size: Int) {
    // Fisher-Yates shuffle algorithm
    for (i in size - 1 downTo 1) {
        val j = rnd.nextInt(i + 1)
        val temp = get(i)
        set(i, get(j))
        set(j, temp)
    }
}

@JvmField var _random: Random? = null
val random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }

fun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, IntArray::get, IntArray::set, size)
fun IntArray.sort() { shuffle(); _sort() }
fun IntArray.sortDescending() { shuffle(); _sortDescending() }

fun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, LongArray::get, LongArray::set, size)
fun LongArray.sort() { shuffle(); _sort() }
fun LongArray.sortDescending() { shuffle(); _sortDescending() }

fun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, DoubleArray::get, DoubleArray::set, size)
fun DoubleArray.sort() { shuffle(); _sort() }
fun DoubleArray.sortDescending() { shuffle(); _sortDescending() }

fun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, CharArray::get, CharArray::set, size)
inline fun CharArray.sort() { _sort() }
inline fun CharArray.sortDescending() { _sortDescending() }

inline fun <T: Comparable<T>> Array<out T>.sort() = _sort()
inline fun <T: Comparable<T>> Array<out T>.sortDescending() = _sortDescending()
inline fun <T: Comparable<T>> MutableList<out T>.sort() = _sort()
inline fun <T: Comparable<T>> MutableList<out T>.sortDescending() = _sortDescending()

fun `please stop removing these imports IntelliJ`() {
    iprintln(max(1, 2))
}


@file:Suppress("NOTHING_TO_INLINE", "EXPERIMENTAL_FEATURE_WARNING", "OVERRIDE_BY_INLINE")

import java.io.PrintWriter
import java.util.StringTokenizer
import kotlin.math.*
import kotlin.random.*
import kotlin.collections.sort as _sort
import kotlin.collections.sortDescending as _sortDescending
import kotlin.io.println as iprintln

/** @author Spheniscine */
fun main() {
    output {
        val n = readInt()
        val A = readLongArray(n)

        var ans = 1L

        val quota = (n+1)/2

        val divTail = LongArray(1e6.toInt())

         for(i in 0 until min(n, certainty)) {
            A.swap(i, random.nextInt(i, n))
            val ar = A[i]
            val G = (0 until n).groupingBy { gcd(ar, A[it]) }.eachCount().entries
                .sortedByDescending { it.key }

             run trial@{
                ar.forEachDivisorDesc(divTail) { d ->
                    if (d <= ans) return@trial
                    var rem = quota
                    for ((g, cn) in G) {
                        if (g < d) return@forEachDivisorDesc
                        if (g % d == 0L) {
                            rem -= cn
                            if (rem <= 0) {
                                ans = d
                                return@trial
                            }
                        }
                    }
                }
            }
        }

        println(ans)
    }
}
const val certainty = 8 // probability of failure = 2^-n
inline fun LongArray.swap(i: Int, j: Int) { this[i] = this[j].also { this[j] = this[i] } }
inline fun Long.forEachDivisorDesc(divTail: LongArray, action: (Long) -> Unit)  {
    var tail_p = -1

    for(p in 1..this) {
        val sq = p * p
        if(sq > this) break
        if(this % p == 0L) {
            action(this / p)
            if(sq != this) divTail[++tail_p] = p
        }
    }

    for(i in tail_p downTo 0) action(divTail[i])
}
tailrec fun gcd(a: Long, b: Long): Long = if(a == 0L) abs(b) else gcd(b % a, a)

/** IO code start */
//@JvmField val INPUT = File("input.txt").inputStream()
//@JvmField val OUTPUT = File("output.txt").outputStream()
@JvmField val INPUT = System.`in`
@JvmField val OUTPUT = System.out

@JvmField val _reader = INPUT.bufferedReader()
fun readLine(): String? = _reader.readLine()
fun readLn() = _reader.readLine()!!
@JvmField var _tokenizer: StringTokenizer = StringTokenizer("")
fun read(): String {
    while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return "", " ")
    return _tokenizer.nextToken()
}
fun readInt() = read().toInt()
fun readDouble() = read().toDouble()
fun readLong() = read().toLong()
fun readStrings(n: Int) = List(n) { read() }
fun readLines(n: Int) = List(n) { readLn() }
fun readInts(n: Int) = List(n) { read().toInt() }
fun readIntArray(n: Int) = IntArray(n) { read().toInt() }
fun readDoubles(n: Int) = List(n) { read().toDouble() }
fun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }
fun readLongs(n: Int) = List(n) { read().toLong() }
fun readLongArray(n: Int) = LongArray(n) { read().toLong() }

@JvmField val _writer = PrintWriter(OUTPUT, false)
inline fun output(block: PrintWriter.() -> Unit) { _writer.apply(block).flush() }

/** shuffles and sort overrides to avoid quicksort attacks */
private inline fun <R, V> R._shuffle(rnd: Random, get: R.(Int) -> V, set: R.(Int, V) -> Unit, size: Int) {
    // Fisher-Yates shuffle algorithm
    for (i in size - 1 downTo 1) {
        val j = rnd.nextInt(i + 1)
        val temp = get(i)
        set(i, get(j))
        set(j, temp)
    }
}

@JvmField var _random: Random? = null
val random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }

fun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, IntArray::get, IntArray::set, size)
fun IntArray.sort() { shuffle(); _sort() }
fun IntArray.sortDescending() { shuffle(); _sortDescending() }

fun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, LongArray::get, LongArray::set, size)
fun LongArray.sort() { shuffle(); _sort() }
fun LongArray.sortDescending() { shuffle(); _sortDescending() }

fun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, DoubleArray::get, DoubleArray::set, size)
fun DoubleArray.sort() { shuffle(); _sort() }
fun DoubleArray.sortDescending() { shuffle(); _sortDescending() }

fun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, CharArray::get, CharArray::set, size)
inline fun CharArray.sort() { _sort() }
inline fun CharArray.sortDescending() { _sortDescending() }

inline fun <T: Comparable<T>> Array<out T>.sort() = _sort()
inline fun <T: Comparable<T>> Array<out T>.sortDescending() = _sortDescending()
inline fun <T: Comparable<T>> MutableList<out T>.sort() = _sort()
inline fun <T: Comparable<T>> MutableList<out T>.sortDescending() = _sortDescending()

fun `please stop removing these imports IntelliJ`() {
    iprintln(max(1, 2))
}


@file:Suppress("NOTHING_TO_INLINE", "EXPERIMENTAL_FEATURE_WARNING", "OVERRIDE_BY_INLINE")

import java.io.PrintWriter
import java.util.StringTokenizer
import java.util.concurrent.Executor
import java.util.concurrent.ExecutorService
import java.util.concurrent.Executors
import java.util.concurrent.TimeUnit
import kotlin.math.*
import kotlin.random.*
import kotlin.collections.sort as _sort
import kotlin.collections.sortDescending as _sortDescending
import kotlin.io.println as iprintln

/** @author Spheniscine */
fun main() {
    //output {
    val executor = Executors.newSingleThreadExecutor()
    executor.execute(Solution)
    executor.awaitTermination(3750, TimeUnit.MILLISECONDS)
    iprintln(Solution.ans)
    //}
}

object Solution: Runnable {
    var ans = 1L
    override fun run() {
        val n = readInt()
        val A = readLongArray(n)

        val quota = (n+1)/2

        trial@ for(i in 0 until n) {
            A.swap(i, random.nextInt(i, n))
            val ar = A[i]
            val D = ar.divisors().toList()
            val G = (0 until n).groupingBy { gcd(ar, A[it]) }.eachCount()

            for(d in D.asReversed()) {
                if(d <= ans) continue@trial
                var rem = quota
                for((g, cn) in G) {
                    if(g % d == 0L) {
                        rem -= cn
                        if(rem <= 0) {
                            ans = d
                            continue@trial
                        }
                    }
                }
            }
        }
    }
}
fun LongArray.swap(i: Int, j: Int) { this[i] = this[j].also { this[j] = this[i] } }
fun Long.divisors() = sequence {
    val n = this@divisors
    if(n <= 0) return@sequence
    val tail = mutableListOf<Long>()

    for(p in 1..Long.MAX_VALUE) {
        val sq = p * p
        if(sq > n) break
        if(n % p == 0L) {
            yield(p)
            if(sq != n) tail.add(n / p)
        }
    }

    yieldAll(tail.asReversed())
}
tailrec fun gcd(a: Long, b: Long): Long = if(a == 0L) abs(b) else gcd(b % a, a)

/** IO code start */
//@JvmField val INPUT = File("input.txt").inputStream()
//@JvmField val OUTPUT = File("output.txt").outputStream()
@JvmField val INPUT = System.`in`
@JvmField val OUTPUT = System.out

@JvmField val _reader = INPUT.bufferedReader()
fun readLine(): String? = _reader.readLine()
fun readLn() = _reader.readLine()!!
@JvmField var _tokenizer: StringTokenizer = StringTokenizer("")
fun read(): String {
    while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return "", " ")
    return _tokenizer.nextToken()
}
fun readInt() = read().toInt()
fun readDouble() = read().toDouble()
fun readLong() = read().toLong()
fun readStrings(n: Int) = List(n) { read() }
fun readLines(n: Int) = List(n) { readLn() }
fun readInts(n: Int) = List(n) { read().toInt() }
fun readIntArray(n: Int) = IntArray(n) { read().toInt() }
fun readDoubles(n: Int) = List(n) { read().toDouble() }
fun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }
fun readLongs(n: Int) = List(n) { read().toLong() }
fun readLongArray(n: Int) = LongArray(n) { read().toLong() }

@JvmField val _writer = PrintWriter(OUTPUT, false)
inline fun output(block: PrintWriter.() -> Unit) { _writer.apply(block).flush() }

/** shuffles and sort overrides to avoid quicksort attacks */
private inline fun <R, V> R._shuffle(rnd: Random, get: R.(Int) -> V, set: R.(Int, V) -> Unit, size: Int) {
    // Fisher-Yates shuffle algorithm
    for (i in size - 1 downTo 1) {
        val j = rnd.nextInt(i + 1)
        val temp = get(i)
        set(i, get(j))
        set(j, temp)
    }
}

@JvmField var _random: Random? = null
val random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }

fun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, IntArray::get, IntArray::set, size)
fun IntArray.sort() { shuffle(); _sort() }
fun IntArray.sortDescending() { shuffle(); _sortDescending() }

fun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, LongArray::get, LongArray::set, size)
fun LongArray.sort() { shuffle(); _sort() }
fun LongArray.sortDescending() { shuffle(); _sortDescending() }

fun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, DoubleArray::get, DoubleArray::set, size)
fun DoubleArray.sort() { shuffle(); _sort() }
fun DoubleArray.sortDescending() { shuffle(); _sortDescending() }

fun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, CharArray::get, CharArray::set, size)
inline fun CharArray.sort() { _sort() }
inline fun CharArray.sortDescending() { _sortDescending() }

inline fun <T: Comparable<T>> Array<out T>.sort() = _sort()
inline fun <T: Comparable<T>> Array<out T>.sortDescending() = _sortDescending()
inline fun <T: Comparable<T>> MutableList<out T>.sort() = _sort()
inline fun <T: Comparable<T>> MutableList<out T>.sortDescending() = _sortDescending()

fun `please stop removing these imports IntelliJ`() {
    iprintln(max(1, 2))
}


@file:Suppress("NOTHING_TO_INLINE", "EXPERIMENTAL_FEATURE_WARNING", "OVERRIDE_BY_INLINE")

import java.io.PrintWriter
import java.util.StringTokenizer
import java.util.concurrent.Executor
import java.util.concurrent.ExecutorService
import java.util.concurrent.Executors
import java.util.concurrent.TimeUnit
import kotlin.math.*
import kotlin.random.*
import kotlin.collections.sort as _sort
import kotlin.collections.sortDescending as _sortDescending
import kotlin.io.println as iprintln

/** @author Spheniscine */
fun main() {
    //output {
    val executor = Executors.newSingleThreadExecutor()
    executor.execute(Solution)
    executor.shutdown()
    executor.awaitTermination(3750, TimeUnit.MILLISECONDS)
    iprintln(Solution.ans)
    //}
}

object Solution: Runnable {
    var ans = 1L
    override fun run() {
        val n = readInt()
        val A = readLongArray(n)

        val quota = (n+1)/2

        trial@ for(i in 0 until n) {
            A.swap(i, random.nextInt(i, n))
            val ar = A[i]
            val D = ar.divisors().toList()
            val G = (0 until n).groupingBy { gcd(ar, A[it]) }.eachCount()

            for(d in D.asReversed()) {
                if(d <= ans) continue@trial
                var rem = quota
                for((g, cn) in G) {
                    if(g % d == 0L) {
                        rem -= cn
                        if(rem <= 0) {
                            ans = d
                            continue@trial
                        }
                    }
                }
            }
        }
    }
}
fun LongArray.swap(i: Int, j: Int) { this[i] = this[j].also { this[j] = this[i] } }
fun Long.divisors() = sequence {
    val n = this@divisors
    if(n <= 0) return@sequence
    val tail = mutableListOf<Long>()

    for(p in 1..Long.MAX_VALUE) {
        val sq = p * p
        if(sq > n) break
        if(n % p == 0L) {
            yield(p)
            if(sq != n) tail.add(n / p)
        }
    }

    yieldAll(tail.asReversed())
}
tailrec fun gcd(a: Long, b: Long): Long = if(a == 0L) abs(b) else gcd(b % a, a)

/** IO code start */
//@JvmField val INPUT = File("input.txt").inputStream()
//@JvmField val OUTPUT = File("output.txt").outputStream()
@JvmField val INPUT = System.`in`
@JvmField val OUTPUT = System.out

@JvmField val _reader = INPUT.bufferedReader()
fun readLine(): String? = _reader.readLine()
fun readLn() = _reader.readLine()!!
@JvmField var _tokenizer: StringTokenizer = StringTokenizer("")
fun read(): String {
    while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return "", " ")
    return _tokenizer.nextToken()
}
fun readInt() = read().toInt()
fun readDouble() = read().toDouble()
fun readLong() = read().toLong()
fun readStrings(n: Int) = List(n) { read() }
fun readLines(n: Int) = List(n) { readLn() }
fun readInts(n: Int) = List(n) { read().toInt() }
fun readIntArray(n: Int) = IntArray(n) { read().toInt() }
fun readDoubles(n: Int) = List(n) { read().toDouble() }
fun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }
fun readLongs(n: Int) = List(n) { read().toLong() }
fun readLongArray(n: Int) = LongArray(n) { read().toLong() }

@JvmField val _writer = PrintWriter(OUTPUT, false)
inline fun output(block: PrintWriter.() -> Unit) { _writer.apply(block).flush() }

/** shuffles and sort overrides to avoid quicksort attacks */
private inline fun <R, V> R._shuffle(rnd: Random, get: R.(Int) -> V, set: R.(Int, V) -> Unit, size: Int) {
    // Fisher-Yates shuffle algorithm
    for (i in size - 1 downTo 1) {
        val j = rnd.nextInt(i + 1)
        val temp = get(i)
        set(i, get(j))
        set(j, temp)
    }
}

@JvmField var _random: Random? = null
val random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }

fun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, IntArray::get, IntArray::set, size)
fun IntArray.sort() { shuffle(); _sort() }
fun IntArray.sortDescending() { shuffle(); _sortDescending() }

fun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, LongArray::get, LongArray::set, size)
fun LongArray.sort() { shuffle(); _sort() }
fun LongArray.sortDescending() { shuffle(); _sortDescending() }

fun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, DoubleArray::get, DoubleArray::set, size)
fun DoubleArray.sort() { shuffle(); _sort() }
fun DoubleArray.sortDescending() { shuffle(); _sortDescending() }

fun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, CharArray::get, CharArray::set, size)
inline fun CharArray.sort() { _sort() }
inline fun CharArray.sortDescending() { _sortDescending() }

inline fun <T: Comparable<T>> Array<out T>.sort() = _sort()
inline fun <T: Comparable<T>> Array<out T>.sortDescending() = _sortDescending()
inline fun <T: Comparable<T>> MutableList<out T>.sort() = _sort()
inline fun <T: Comparable<T>> MutableList<out T>.sortDescending() = _sortDescending()

fun `please stop removing these imports IntelliJ`() {
    iprintln(max(1, 2))
}


@file:Suppress("NOTHING_TO_INLINE", "EXPERIMENTAL_FEATURE_WARNING", "OVERRIDE_BY_INLINE")

import java.io.PrintWriter
import java.util.StringTokenizer
import kotlin.math.*
import kotlin.random.*
import kotlin.collections.sort as _sort
import kotlin.collections.sortDescending as _sortDescending
import kotlin.io.println as iprintln

/** @author Spheniscine */
fun main() {
    output {
        val n = readInt()
        val A = readLongArray(n)

        var ans = 1L

        val quota = (n+1)/2

        trial@ for(i in 0 until min(n, certainty)) {
            A.swap(i, random.nextInt(i, n))
            val ar = A[i]
            val G = (0 until n).groupingBy { gcd(ar, A[it]) }.eachCount().asIterable()
                .sortedByDescending { it.key }

            d@ for(d in ar.divisorsDesc()) {
                if(d <= ans) continue@trial
                var rem = quota
                for((g, cn) in G) {
                    if(g < d) continue@d
                    if(g % d == 0L) {
                        rem -= cn
                        if(rem <= 0) {
                            ans = d
                            continue@trial
                        }
                    }
                }
            }
        }

        println(ans)
    }
}
const val certainty = 10 // probability of failure = 2^-n
fun LongArray.swap(i: Int, j: Int) { this[i] = this[j].also { this[j] = this[i] } }
fun Long.divisorsDesc() = sequence {
    val n = this@divisorsDesc
    if(n <= 0) return@sequence
    val tail = mutableListOf<Long>()

    for(p in 1..Long.MAX_VALUE) {
        val sq = p * p
        if(sq > n) break
        if(n % p == 0L) {
            yield(n / p)
            if(sq != n) tail.add(p)
        }
    }

    yieldAll(tail.asReversed())
}
tailrec fun gcd(a: Long, b: Long): Long = if(a == 0L) abs(b) else gcd(b % a, a)

/** IO code start */
//@JvmField val INPUT = File("input.txt").inputStream()
//@JvmField val OUTPUT = File("output.txt").outputStream()
@JvmField val INPUT = System.`in`
@JvmField val OUTPUT = System.out

@JvmField val _reader = INPUT.bufferedReader()
fun readLine(): String? = _reader.readLine()
fun readLn() = _reader.readLine()!!
@JvmField var _tokenizer: StringTokenizer = StringTokenizer("")
fun read(): String {
    while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return "", " ")
    return _tokenizer.nextToken()
}
fun readInt() = read().toInt()
fun readDouble() = read().toDouble()
fun readLong() = read().toLong()
fun readStrings(n: Int) = List(n) { read() }
fun readLines(n: Int) = List(n) { readLn() }
fun readInts(n: Int) = List(n) { read().toInt() }
fun readIntArray(n: Int) = IntArray(n) { read().toInt() }
fun readDoubles(n: Int) = List(n) { read().toDouble() }
fun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }
fun readLongs(n: Int) = List(n) { read().toLong() }
fun readLongArray(n: Int) = LongArray(n) { read().toLong() }

@JvmField val _writer = PrintWriter(OUTPUT, false)
inline fun output(block: PrintWriter.() -> Unit) { _writer.apply(block).flush() }

/** shuffles and sort overrides to avoid quicksort attacks */
private inline fun <R, V> R._shuffle(rnd: Random, get: R.(Int) -> V, set: R.(Int, V) -> Unit, size: Int) {
    // Fisher-Yates shuffle algorithm
    for (i in size - 1 downTo 1) {
        val j = rnd.nextInt(i + 1)
        val temp = get(i)
        set(i, get(j))
        set(j, temp)
    }
}

@JvmField var _random: Random? = null
val random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }

fun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, IntArray::get, IntArray::set, size)
fun IntArray.sort() { shuffle(); _sort() }
fun IntArray.sortDescending() { shuffle(); _sortDescending() }

fun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, LongArray::get, LongArray::set, size)
fun LongArray.sort() { shuffle(); _sort() }
fun LongArray.sortDescending() { shuffle(); _sortDescending() }

fun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, DoubleArray::get, DoubleArray::set, size)
fun DoubleArray.sort() { shuffle(); _sort() }
fun DoubleArray.sortDescending() { shuffle(); _sortDescending() }

fun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, CharArray::get, CharArray::set, size)
inline fun CharArray.sort() { _sort() }
inline fun CharArray.sortDescending() { _sortDescending() }

inline fun <T: Comparable<T>> Array<out T>.sort() = _sort()
inline fun <T: Comparable<T>> Array<out T>.sortDescending() = _sortDescending()
inline fun <T: Comparable<T>> MutableList<out T>.sort() = _sort()
inline fun <T: Comparable<T>> MutableList<out T>.sortDescending() = _sortDescending()

fun `please stop removing these imports IntelliJ`() {
    iprintln(max(1, 2))
}


@file:Suppress("NOTHING_TO_INLINE", "EXPERIMENTAL_FEATURE_WARNING", "OVERRIDE_BY_INLINE")

import java.io.PrintWriter
import java.util.StringTokenizer
import kotlin.math.*
import kotlin.random.*
import kotlin.collections.sort as _sort
import kotlin.collections.sortDescending as _sortDescending
import kotlin.io.println as iprintln

/** @author Spheniscine */
fun main() {
    output {
        val n = readInt()
        val A = readLongArray(n)

        var ans = 1L

        val quota = (n+1)/2

        val divisorMap = object {
            inline val capacity get() = 6720
            var numDivisors = 0
            val divisorsArr = LongArray(capacity)
            val cnt = IntArray(capacity)

            fun loadDivisors(value: Long, downUntil: Long) {
                run {
                    numDivisors = 0
                    var tail_p = capacity

                    for (p in 1..value) {
                        val sq = p * p
                        if (sq > value) break
                        if (value % p == 0L) {
                            val q = value / p
                            if (q <= downUntil) return@run
                            divisorsArr[numDivisors++] = q
                            if (sq != value) divisorsArr[--tail_p] = p
                        }
                    }

                    for (i in tail_p until capacity) {
                        if (divisorsArr[i] <= downUntil) return@run
                        divisorsArr[numDivisors++] = divisorsArr[i]
                    }
                }

                for(i in 0 until numDivisors) {
                    cnt[i] = 0
                }
            }

            fun findIndex(d: Long): Int {
                var low = 0
                var high = numDivisors - 1

                while (low <= high) {
                    val mid = low.and(high) + low.xor(high).shr(1)
                    val cmp = d.compareTo(divisorsArr[mid])

                    when {
                        cmp < 0 -> low = mid + 1
                        cmp > 0 -> high = mid - 1
                        else -> return mid
                    }
                }
                return -1
            }

            fun incCnt(d: Long) { cnt[findIndex(d)]++ }

            inline fun forEachDivisor(action: (Long) -> Unit) {
                for(i in 0 until numDivisors) action(divisorsArr[i])
            }

            inline fun forEachEntry(action: (Long, Int) -> Unit) {
                for(i in 0 until numDivisors) action(divisorsArr[i], cnt[i])
            }
        }

        for(i in 0 until min(n, certainty)) {
            A.swap(i, random.nextInt(i, n))
            val ar = A[i]
            divisorMap.loadDivisors(ar, ans)
            for(a in A) {
                val g = gcd(a, ar)
                if(g > ans) divisorMap.incCnt(g)
            }

            run trial@{
                divisorMap.forEachDivisor { d ->
                    var rem = quota
                    divisorMap.forEachEntry { g, cn ->
                        if (g < d) return@forEachDivisor
                        if (g % d == 0L) {
                            rem -= cn
                            if (rem <= 0) {
                                ans = d
                                return@trial
                            }
                        }
                    }
                }
            }
        }

        println(ans)
    }
}
const val certainty = 10 // probability of failure = 2^-n
inline fun LongArray.swap(i: Int, j: Int) { this[i] = this[j].also { this[j] = this[i] } }
tailrec fun gcd(a: Long, b: Long): Long = if(a == 0L) abs(b) else gcd(b % a, a)

/** IO code start */
//@JvmField val INPUT = File("input.txt").inputStream()
//@JvmField val OUTPUT = File("output.txt").outputStream()
@JvmField val INPUT = System.`in`
@JvmField val OUTPUT = System.out

@JvmField val _reader = INPUT.bufferedReader()
fun readLine(): String? = _reader.readLine()
fun readLn() = _reader.readLine()!!
@JvmField var _tokenizer: StringTokenizer = StringTokenizer("")
fun read(): String {
    while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return "", " ")
    return _tokenizer.nextToken()
}
fun readInt() = read().toInt()
fun readDouble() = read().toDouble()
fun readLong() = read().toLong()
fun readStrings(n: Int) = List(n) { read() }
fun readLines(n: Int) = List(n) { readLn() }
fun readInts(n: Int) = List(n) { read().toInt() }
fun readIntArray(n: Int) = IntArray(n) { read().toInt() }
fun readDoubles(n: Int) = List(n) { read().toDouble() }
fun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }
fun readLongs(n: Int) = List(n) { read().toLong() }
fun readLongArray(n: Int) = LongArray(n) { read().toLong() }

@JvmField val _writer = PrintWriter(OUTPUT, false)
inline fun output(block: PrintWriter.() -> Unit) { _writer.apply(block).flush() }

/** shuffles and sort overrides to avoid quicksort attacks */
private inline fun <R, V> R._shuffle(rnd: Random, get: R.(Int) -> V, set: R.(Int, V) -> Unit, size: Int) {
    // Fisher-Yates shuffle algorithm
    for (i in size - 1 downTo 1) {
        val j = rnd.nextInt(i + 1)
        val temp = get(i)
        set(i, get(j))
        set(j, temp)
    }
}

@JvmField var _random: Random? = null
val random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }

fun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, IntArray::get, IntArray::set, size)
fun IntArray.sort() { shuffle(); _sort() }
fun IntArray.sortDescending() { shuffle(); _sortDescending() }

fun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, LongArray::get, LongArray::set, size)
fun LongArray.sort() { shuffle(); _sort() }
fun LongArray.sortDescending() { shuffle(); _sortDescending() }

fun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, DoubleArray::get, DoubleArray::set, size)
fun DoubleArray.sort() { shuffle(); _sort() }
fun DoubleArray.sortDescending() { shuffle(); _sortDescending() }

fun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, CharArray::get, CharArray::set, size)
inline fun CharArray.sort() { _sort() }
inline fun CharArray.sortDescending() { _sortDescending() }

inline fun <T: Comparable<T>> Array<out T>.sort() = _sort()
inline fun <T: Comparable<T>> Array<out T>.sortDescending() = _sortDescending()
inline fun <T: Comparable<T>> MutableList<out T>.sort() = _sort()
inline fun <T: Comparable<T>> MutableList<out T>.sortDescending() = _sortDescending()

fun `please stop removing these imports IntelliJ`() {
    iprintln(max(1, 2))
}


@file:Suppress("NOTHING_TO_INLINE", "EXPERIMENTAL_FEATURE_WARNING", "OVERRIDE_BY_INLINE")

import java.io.PrintWriter
import java.util.StringTokenizer
import kotlin.math.*
import kotlin.random.*
import kotlin.collections.sort as _sort
import kotlin.collections.sortDescending as _sortDescending
import kotlin.io.println as iprintln

/** @author Spheniscine */
fun main() {
    output {
        val n = readInt()
        val A = readLongArray(n)

        var ans = 1L

        val quota = (n+1)/2

        trial@ for(i in 0 until min(n, certainty)) {
            A.swap(i, random.nextInt(i, n))
            val ar = A[i]
            val D = ar.divisors().toList()
            val G = (0 until n).groupingBy { gcd(ar, A[it]) }.eachCount()

            for(d in D.asReversed()) {
                if(d <= ans) continue@trial
                var rem = quota
                for((g, cn) in G) {
                    if(g % d == 0L) {
                        rem -= cn
                        if(rem <= 0) {
                            ans = max(ans, d)
                            continue@trial
                        }
                    }
                }
            }
        }

        println(ans)
    }
}
const val certainty = 5 // probability of failure = 2^-n
fun LongArray.swap(i: Int, j: Int) { this[i] = this[j].also { this[j] = this[i] } }
fun Long.divisors() = sequence {
    val n = this@divisors
    if(n <= 0) return@sequence
    val tail = mutableListOf<Long>()

    for(p in 1..Long.MAX_VALUE) {
        val sq = p * p
        if(sq > n) break
        if(n % p == 0L) {
            yield(p)
            if(sq != n) tail.add(n / p)
        }
    }

    yieldAll(tail.asReversed())
}
tailrec fun gcd(a: Long, b: Long): Long = if(a == 0L) abs(b) else gcd(b % a, a)

/** IO code start */
//@JvmField val INPUT = File("input.txt").inputStream()
//@JvmField val OUTPUT = File("output.txt").outputStream()
@JvmField val INPUT = System.`in`
@JvmField val OUTPUT = System.out

@JvmField val _reader = INPUT.bufferedReader()
fun readLine(): String? = _reader.readLine()
fun readLn() = _reader.readLine()!!
@JvmField var _tokenizer: StringTokenizer = StringTokenizer("")
fun read(): String {
    while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return "", " ")
    return _tokenizer.nextToken()
}
fun readInt() = read().toInt()
fun readDouble() = read().toDouble()
fun readLong() = read().toLong()
fun readStrings(n: Int) = List(n) { read() }
fun readLines(n: Int) = List(n) { readLn() }
fun readInts(n: Int) = List(n) { read().toInt() }
fun readIntArray(n: Int) = IntArray(n) { read().toInt() }
fun readDoubles(n: Int) = List(n) { read().toDouble() }
fun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }
fun readLongs(n: Int) = List(n) { read().toLong() }
fun readLongArray(n: Int) = LongArray(n) { read().toLong() }

@JvmField val _writer = PrintWriter(OUTPUT, false)
inline fun output(block: PrintWriter.() -> Unit) { _writer.apply(block).flush() }

/** shuffles and sort overrides to avoid quicksort attacks */
private inline fun <R, V> R._shuffle(rnd: Random, get: R.(Int) -> V, set: R.(Int, V) -> Unit, size: Int) {
    // Fisher-Yates shuffle algorithm
    for (i in size - 1 downTo 1) {
        val j = rnd.nextInt(i + 1)
        val temp = get(i)
        set(i, get(j))
        set(j, temp)
    }
}

@JvmField var _random: Random? = null
val random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }

fun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, IntArray::get, IntArray::set, size)
fun IntArray.sort() { shuffle(); _sort() }
fun IntArray.sortDescending() { shuffle(); _sortDescending() }

fun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, LongArray::get, LongArray::set, size)
fun LongArray.sort() { shuffle(); _sort() }
fun LongArray.sortDescending() { shuffle(); _sortDescending() }

fun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, DoubleArray::get, DoubleArray::set, size)
fun DoubleArray.sort() { shuffle(); _sort() }
fun DoubleArray.sortDescending() { shuffle(); _sortDescending() }

fun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, CharArray::get, CharArray::set, size)
inline fun CharArray.sort() { _sort() }
inline fun CharArray.sortDescending() { _sortDescending() }

inline fun <T: Comparable<T>> Array<out T>.sort() = _sort()
inline fun <T: Comparable<T>> Array<out T>.sortDescending() = _sortDescending()
inline fun <T: Comparable<T>> MutableList<out T>.sort() = _sort()
inline fun <T: Comparable<T>> MutableList<out T>.sortDescending() = _sortDescending()

fun `please stop removing these imports IntelliJ`() {
    iprintln(max(1, 2))
}


@file:Suppress("NOTHING_TO_INLINE", "EXPERIMENTAL_FEATURE_WARNING", "OVERRIDE_BY_INLINE")

import java.io.PrintWriter
import java.util.StringTokenizer
import kotlin.math.*
import kotlin.random.Random
import kotlin.collections.sort as _sort
import kotlin.collections.sortDescending as _sortDescending
import kotlin.io.println as iprintln

/** @author Spheniscine */
fun main() { _writer.solve(); _writer.flush() }
fun PrintWriter.solve() {
    val startTime = System.nanoTime()
    val n = readInt()
    val A = readLongArray(n)

    var ans = 1L

    val quota = (n+1)/2

    val divisorMap = object {
        inline val capacity get() = 6720
        @JvmField var numDivisors = 0
        var bsBit = 0
        @JvmField val divisorsArr = LongArray(capacity)
        @JvmField val cnt = IntArray(capacity)

        fun loadDivisors(value: Long, downUntil: Long) {
            run {
                numDivisors = 0
                var tail_p = capacity

                for (p in 1..value) {
                    val sq = p * p
                    if (sq > value) break
                    val q = value / p
                    if (q * p == value) {
                        if (q <= downUntil) return@run
                        divisorsArr[numDivisors++] = q
                        if (sq != value && p > downUntil) divisorsArr[--tail_p] = p
                    }
                }

                for (i in tail_p until capacity) {
                    divisorsArr[numDivisors++] = divisorsArr[i]
                }
            }

            for(i in 0 until numDivisors) {
                cnt[i] = 0
            }

            bsBit = Integer.highestOneBit(numDivisors)
        }

        fun findIndex(d: Long): Int {
            var bit = bsBit
            var pos = 0

            while(bit > 0) {
                val npos = pos or bit
                if(npos <= numDivisors && divisorsArr[npos-1] > d) pos = npos
                bit = bit shr 1
            }
            return pos
        }

        fun incCnt(d: Long) { cnt[findIndex(d)]++ }

        inline fun forEachDivisor(action: (Long) -> Unit) {
            for(i in 0 until numDivisors) action(divisorsArr[i])
        }

        inline fun forEachEntry(action: (Long, Int) -> Unit) {
            for(i in 0 until numDivisors) action(divisorsArr[i], cnt[i])
        }
    }

    for(i in 0 until n/2 + 1) {
        if(System.nanoTime() - startTime > timeLimit) break
        A.swap(i, random.nextInt(i, n))
        val ar = A[i]
        divisorMap.loadDivisors(ar, ans)
        for(a in A) {
            val g = gcd(a, ar)
            if(g > ans) divisorMap.incCnt(g)
        }

        run trial@{
            divisorMap.forEachDivisor { d ->
                var rem = quota
                divisorMap.forEachEntry { g, cn ->
                    if (g < d) return@forEachDivisor
                    if (g % d == 0L) {
                        rem -= cn
                        if (rem <= 0) {
                            ans = d
                            return@trial
                        }
                    }
                }
            }
        }
    }

    println(ans)
}

const val timeLimit = 3.7e9.toLong()
inline fun LongArray.swap(i: Int, j: Int) { this[i] = this[j].also { this[j] = this[i] } }
tailrec fun gcd(a: Long, b: Long): Long = if(a == 0L) abs(b) else gcd(b % a, a)

/** IO code start */
//@JvmField val INPUT = File("input.txt").inputStream()
//@JvmField val OUTPUT = File("output.txt").outputStream()
@JvmField val INPUT = System.`in`
@JvmField val OUTPUT = System.out

@JvmField val _reader = INPUT.bufferedReader()
fun readLine(): String? = _reader.readLine()
fun readLn() = _reader.readLine()!!
@JvmField var _tokenizer: StringTokenizer = StringTokenizer("")
fun read(): String {
    while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return "", " ")
    return _tokenizer.nextToken()
}
fun readInt() = read().toInt()
fun readDouble() = read().toDouble()
fun readLong() = read().toLong()
fun readStrings(n: Int) = List(n) { read() }
fun readLines(n: Int) = List(n) { readLn() }
fun readInts(n: Int) = List(n) { read().toInt() }
fun readIntArray(n: Int) = IntArray(n) { read().toInt() }
fun readDoubles(n: Int) = List(n) { read().toDouble() }
fun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }
fun readLongs(n: Int) = List(n) { read().toLong() }
fun readLongArray(n: Int) = LongArray(n) { read().toLong() }

@JvmField val _writer = PrintWriter(OUTPUT, false)

/** shuffles and sort overrides to avoid quicksort attacks */
private inline fun <T> _shuffle(rnd: Random, get: (Int) -> T, set: (Int, T) -> Unit, size: Int) {
    // Fisher-Yates shuffle algorithm
    for (i in size - 1 downTo 1) {
        val j = rnd.nextInt(i + 1)
        val temp = get(i)
        set(i, get(j))
        set(j, temp)
    }
}

@JvmField var _random: Random? = null
val random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }

fun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
fun IntArray.sort() { shuffle(); _sort() }
fun IntArray.sortDescending() { shuffle(); _sortDescending() }

fun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
fun LongArray.sort() { shuffle(); _sort() }
fun LongArray.sortDescending() { shuffle(); _sortDescending() }

fun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
fun DoubleArray.sort() { shuffle(); _sort() }
fun DoubleArray.sortDescending() { shuffle(); _sortDescending() }

fun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, ::get, ::set, size)
inline fun CharArray.sort() { _sort() }
inline fun CharArray.sortDescending() { _sortDescending() }

inline fun <T: Comparable<T>> Array<out T>.sort() = _sort()
inline fun <T: Comparable<T>> Array<out T>.sortDescending() = _sortDescending()
inline fun <T: Comparable<T>> MutableList<out T>.sort() = _sort()
inline fun <T: Comparable<T>> MutableList<out T>.sortDescending() = _sortDescending()

fun `please stop removing these imports IntelliJ`() {
    iprintln(max(1, 2))
}


@file:Suppress("NOTHING_TO_INLINE", "EXPERIMENTAL_FEATURE_WARNING", "OVERRIDE_BY_INLINE")

import java.io.PrintWriter
import java.util.StringTokenizer
import kotlin.math.*
import kotlin.random.*
import kotlin.collections.sort as _sort
import kotlin.collections.sortDescending as _sortDescending
import kotlin.io.println as iprintln

/** @author Spheniscine */
fun main() {
    output {
        val n = readInt()
        val A = readLongArray(n)

        var ans = 1L

        val quota = (n+1)/2

        val divisorMap = object {
            inline val capacity get() = 6720
            var numDivisors = 0
            val divisorsArr = LongArray(capacity)
            val cnt = IntArray(capacity)

            fun loadDivisors(value: Long, downUntil: Long) {
                run {
                    numDivisors = 0
                    var tail_p = capacity

                    for (p in 1..value) {
                        val sq = p * p
                        if (sq > value) break
                        if (value % p == 0L) {
                            val q = value / p
                            if (q <= downUntil) return@run
                            divisorsArr[numDivisors++] = q
                            if (sq != value) divisorsArr[--tail_p] = p
                        }
                    }

                    for (i in tail_p until capacity) {
                        if (divisorsArr[i] <= downUntil) return@run
                        divisorsArr[numDivisors++] = divisorsArr[i]
                    }
                }

                for(i in 0 until numDivisors) {
                    cnt[i] = 0
                }
            }

            fun findIndex(d: Long): Int {
                var low = 0
                var high = numDivisors - 1

                while (low <= high) {
                    val mid = low.and(high) + low.xor(high).shr(1)
                    val cmp = d.compareTo(divisorsArr[mid])

                    when {
                        cmp < 0 -> low = mid + 1
                        cmp > 0 -> high = mid - 1
                        else -> return mid
                    }
                }
                return -1
            }

            fun incCnt(d: Long) { cnt[findIndex(d)]++ }

            inline fun forEachDivisor(action: (Long) -> Unit) {
                for(i in 0 until numDivisors) action(divisorsArr[i])
            }

            inline fun forEachEntry(action: (Long, Int) -> Unit) {
                for(i in 0 until numDivisors) action(divisorsArr[i], cnt[i])
            }
        }

        for(i in 0 until min(n, certainty)) {
            A.swap(i, random.nextInt(i, n))
            val ar = A[i]
            divisorMap.loadDivisors(ar, ans)
            for(a in A) {
                val g = gcd(a, ar)
                if(g > ans) divisorMap.incCnt(g)
            }

            run trial@{
                divisorMap.forEachDivisor { d ->
                    var rem = quota
                    divisorMap.forEachEntry { g, cn ->
                        if (g < d) return@forEachDivisor
                        if (g % d == 0L) {
                            rem -= cn
                            if (rem <= 0) {
                                ans = d
                                return@trial
                            }
                        }
                    }
                }
            }
        }

        println(ans)
    }
}
const val certainty = 9 // probability of failure = 2^-n
inline fun LongArray.swap(i: Int, j: Int) { this[i] = this[j].also { this[j] = this[i] } }
tailrec fun gcd(a: Long, b: Long): Long = if(a == 0L) abs(b) else gcd(b % a, a)

/** IO code start */
//@JvmField val INPUT = File("input.txt").inputStream()
//@JvmField val OUTPUT = File("output.txt").outputStream()
@JvmField val INPUT = System.`in`
@JvmField val OUTPUT = System.out

@JvmField val _reader = INPUT.bufferedReader()
fun readLine(): String? = _reader.readLine()
fun readLn() = _reader.readLine()!!
@JvmField var _tokenizer: StringTokenizer = StringTokenizer("")
fun read(): String {
    while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return "", " ")
    return _tokenizer.nextToken()
}
fun readInt() = read().toInt()
fun readDouble() = read().toDouble()
fun readLong() = read().toLong()
fun readStrings(n: Int) = List(n) { read() }
fun readLines(n: Int) = List(n) { readLn() }
fun readInts(n: Int) = List(n) { read().toInt() }
fun readIntArray(n: Int) = IntArray(n) { read().toInt() }
fun readDoubles(n: Int) = List(n) { read().toDouble() }
fun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }
fun readLongs(n: Int) = List(n) { read().toLong() }
fun readLongArray(n: Int) = LongArray(n) { read().toLong() }

@JvmField val _writer = PrintWriter(OUTPUT, false)
inline fun output(block: PrintWriter.() -> Unit) { _writer.apply(block).flush() }

/** shuffles and sort overrides to avoid quicksort attacks */
private inline fun <R, V> R._shuffle(rnd: Random, get: R.(Int) -> V, set: R.(Int, V) -> Unit, size: Int) {
    // Fisher-Yates shuffle algorithm
    for (i in size - 1 downTo 1) {
        val j = rnd.nextInt(i + 1)
        val temp = get(i)
        set(i, get(j))
        set(j, temp)
    }
}

@JvmField var _random: Random? = null
val random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }

fun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, IntArray::get, IntArray::set, size)
fun IntArray.sort() { shuffle(); _sort() }
fun IntArray.sortDescending() { shuffle(); _sortDescending() }

fun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, LongArray::get, LongArray::set, size)
fun LongArray.sort() { shuffle(); _sort() }
fun LongArray.sortDescending() { shuffle(); _sortDescending() }

fun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, DoubleArray::get, DoubleArray::set, size)
fun DoubleArray.sort() { shuffle(); _sort() }
fun DoubleArray.sortDescending() { shuffle(); _sortDescending() }

fun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, CharArray::get, CharArray::set, size)
inline fun CharArray.sort() { _sort() }
inline fun CharArray.sortDescending() { _sortDescending() }

inline fun <T: Comparable<T>> Array<out T>.sort() = _sort()
inline fun <T: Comparable<T>> Array<out T>.sortDescending() = _sortDescending()
inline fun <T: Comparable<T>> MutableList<out T>.sort() = _sort()
inline fun <T: Comparable<T>> MutableList<out T>.sortDescending() = _sortDescending()

fun `please stop removing these imports IntelliJ`() {
    iprintln(max(1, 2))
}


@file:Suppress("NOTHING_TO_INLINE", "EXPERIMENTAL_FEATURE_WARNING", "OVERRIDE_BY_INLINE")

import java.io.PrintWriter
import java.util.StringTokenizer
import kotlin.math.*
import kotlin.random.*
import kotlin.collections.sort as _sort
import kotlin.collections.sortDescending as _sortDescending
import kotlin.io.println as iprintln

/** @author Spheniscine */
fun main() {
    output {
        val n = readInt()
        val A = readLongArray(n)

        var ans = 1L

        val quota = (n+1)/2

        trial@ for(i in 0 until min(n, certainty)) {
            A.swap(i, random.nextInt(i, n))
            val ar = A[i]
            val D = ar.divisors().toList()
            val G = (0 until n).groupingBy { gcd(ar, A[it]) }.eachCount()

            for(d in D.asReversed()) {
                if(d <= ans) continue@trial
                var rem = quota
                for((g, cn) in G) {
                    if(g % d == 0L) {
                        rem -= cn
                        if(rem <= 0) {
                            ans = max(ans, d)
                            continue@trial
                        }
                    }
                }
            }
        }

        println(ans)
    }
}
const val certainty = 30 // probability of failure = 2^-n
fun LongArray.swap(i: Int, j: Int) { this[i] = this[j].also { this[j] = this[i] } }
fun Long.divisors() = sequence {
    val n = this@divisors
    if(n <= 0) return@sequence
    val tail = mutableListOf<Long>()

    for(p in 1..Long.MAX_VALUE) {
        val sq = p * p
        if(sq > n) break
        if(n % p == 0L) {
            yield(p)
            if(sq != n) tail.add(n / p)
        }
    }

    yieldAll(tail.asReversed())
}
tailrec fun gcd(a: Long, b: Long): Long = if(a == 0L) abs(b) else gcd(b % a, a)

/** IO code start */
//@JvmField val INPUT = File("input.txt").inputStream()
//@JvmField val OUTPUT = File("output.txt").outputStream()
@JvmField val INPUT = System.`in`
@JvmField val OUTPUT = System.out

@JvmField val _reader = INPUT.bufferedReader()
fun readLine(): String? = _reader.readLine()
fun readLn() = _reader.readLine()!!
@JvmField var _tokenizer: StringTokenizer = StringTokenizer("")
fun read(): String {
    while (_tokenizer.hasMoreTokens().not()) _tokenizer = StringTokenizer(_reader.readLine() ?: return "", " ")
    return _tokenizer.nextToken()
}
fun readInt() = read().toInt()
fun readDouble() = read().toDouble()
fun readLong() = read().toLong()
fun readStrings(n: Int) = List(n) { read() }
fun readLines(n: Int) = List(n) { readLn() }
fun readInts(n: Int) = List(n) { read().toInt() }
fun readIntArray(n: Int) = IntArray(n) { read().toInt() }
fun readDoubles(n: Int) = List(n) { read().toDouble() }
fun readDoubleArray(n: Int) = DoubleArray(n) { read().toDouble() }
fun readLongs(n: Int) = List(n) { read().toLong() }
fun readLongArray(n: Int) = LongArray(n) { read().toLong() }

@JvmField val _writer = PrintWriter(OUTPUT, false)
inline fun output(block: PrintWriter.() -> Unit) { _writer.apply(block).flush() }

/** shuffles and sort overrides to avoid quicksort attacks */
private inline fun <R, V> R._shuffle(rnd: Random, get: R.(Int) -> V, set: R.(Int, V) -> Unit, size: Int) {
    // Fisher-Yates shuffle algorithm
    for (i in size - 1 downTo 1) {
        val j = rnd.nextInt(i + 1)
        val temp = get(i)
        set(i, get(j))
        set(j, temp)
    }
}

@JvmField var _random: Random? = null
val random get() = _random ?: Random(0x594E215C123 * System.nanoTime()).also { _random = it }

fun IntArray.shuffle(rnd: Random = random) = _shuffle(rnd, IntArray::get, IntArray::set, size)
fun IntArray.sort() { shuffle(); _sort() }
fun IntArray.sortDescending() { shuffle(); _sortDescending() }

fun LongArray.shuffle(rnd: Random = random) = _shuffle(rnd, LongArray::get, LongArray::set, size)
fun LongArray.sort() { shuffle(); _sort() }
fun LongArray.sortDescending() { shuffle(); _sortDescending() }

fun DoubleArray.shuffle(rnd: Random = random) = _shuffle(rnd, DoubleArray::get, DoubleArray::set, size)
fun DoubleArray.sort() { shuffle(); _sort() }
fun DoubleArray.sortDescending() { shuffle(); _sortDescending() }

fun CharArray.shuffle(rnd: Random = random) = _shuffle(rnd, CharArray::get, CharArray::set, size)
inline fun CharArray.sort() { _sort() }
inline fun CharArray.sortDescending() { _sortDescending() }

inline fun <T: Comparable<T>> Array<out T>.sort() = _sort()
inline fun <T: Comparable<T>> Array<out T>.sortDescending() = _sortDescending()
inline fun <T: Comparable<T>> MutableList<out T>.sort() = _sort()
inline fun <T: Comparable<T>> MutableList<out T>.sortDescending() = _sortDescending()

fun `please stop removing these imports IntelliJ`() {
    iprintln(max(1, 2))
}