func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long MOD = 1e9 + 7;   const double err = 1e-12;   const double PI = 3.141592653589793;   const int N = 2e5 + 5;   int n;   vector<int> V;   bool chk(int val) {     auto it = upper_bound((V).begin(), (V).end(), val);     for (; it != V.end(); it++) {       int aj = *it, ai = *it + val;       while (ai <= V.back()) {         auto tmp = lower_bound((V).begin(), (V).end(), ai);         if (tmp != V.end() && (*tmp) % aj >= val) return true;         ai += aj;       }     }     return false;   }   void solve() {     cin >> n;     V = vector<int>(n);     for (int i = 0; i < n; i++) cin >> V[i];     sort((V).begin(), (V).end());     V.erase(unique((V).begin(), (V).end()), V.end());     int l = 1, r = 1e6, ans = 0;     while (l <= r) {       int m = (l + r) / 2;       if (chk(m)) {         ans = m;         l = m + 1;       } else         r = m - 1;     }     cout << ans <<   n ;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     int t = 1;     while (t--) solve();     return 0;   }   