1. Abridged Problem Statement  
Given n distinct positive integers (each ≤ 2^20), find the maximum greatest common divisor (GCD) among all pairs of these numbers.

2. Detailed Editorial  
Goal: Maximize gcd(a, b) over all 1 ≤ i < j ≤ n.

Observation: For any candidate d, gcd(a, b) = d if and only if both a and b are multiples of d and have no larger common divisor exceeding d. However, to check the maximum possible gcd among all pairs, it suffices to test for each d from largest to smallest whether there are at least two input numbers divisible by d. The largest such d is the answer.

Approach:  
- Let M = 2^20 (upper bound on values).  
- Create a boolean array used[1…M−1], marking which integers appear in input.  
- For each d from 1 to M−1, count how many multiples of d appear: sum over j = d, 2d, 3d, … of used[j].  
- If the count ≥ 2, d is a candidate gcd. Track the maximum d found.  
- Output that maximum.

Complexity:  
- Building the used[] array: O(n).  
- Summing multiples for each d: ∑_{d=1 to M} (M/d) = O(M log M) ≈ 20·10^6, fits in 0.5 s in C++.  
- Memory: O(M).

3. Provided C++ Solution with Detailed Comments  
#include <bits/stdc++.h>  
using namespace std;  
const int MAXN = (1 << 20);  // Upper bound on friendship numbers

int n;  
bool used[MAXN];  // used[x] = true if x appears in input

// Read n and mark each input number in used[]
void read() {
    cin >> n;
    for(int i = 0; i < n; i++) {
        int x;
        cin >> x;
        used[x] = true;  // mark presence
    }
}

// Utility to update x = max(x, y)
template<class T, class U>
inline void chkmax(T &x, const U &y) {
    if (x < y) x = y;
}

// Core solution: for each d, count multiples; if ≥2, candidate gcd
void solve() {
    int answer = 1;  // answer at least 1 (gcd of any two distinct positive ints ≥ 1)

    // Try every possible gcd d
    for(int d = 1; d < MAXN; d++) {
        int cnt = 0;
        // Count how many input numbers are multiples of d
        for(int j = d; j < MAXN; j += d) {
            if (used[j]) cnt++;
            if (cnt >= 2) break;  // no need to count past 2
        }
        // If at least two numbers share divisor d, update answer
        if (cnt >= 2) {
            chkmax(answer, d);
        }
    }

    // Output the largest valid gcd
    cout << answer << '\n';
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    read();
    solve();
    return 0;
}

4. Python Solution with Detailed Comments  
```python
import sys
def main():
    data = sys.stdin.read().split()
    n = int(data[0])
    nums = list(map(int, data[1:]))

    M = 1 << 20
    used = [False] * M
    # Mark presence
    for x in nums:
        used[x] = True

    answer = 1
    # For each possible gcd d
    for d in range(1, M):
        cnt = 0
        # Check multiples of d
        for j in range(d, M, d):
            if used[j]:
                cnt += 1
                if cnt >= 2:
                    # We found at least two multiples, update answer
                    answer = max(answer, d)
                    break
    print(answer)

if __name__ == "__main__":
    main()
```

5. Compressed Editorial  
- Mark all input numbers in a boolean array up to 2^20.  
- For each d from 1 to 2^20–1, count present multiples of d.  
- If count ≥2, d is a candidate gcd; track the maximum.  
- Time O(M log M), memory O(M).