func_code_string: #include <bits/stdc++.h>   #pragma GCC optimize( Ofast )   using namespace std;   using ll = long long;   using ld = long double;   ll mod = 998244353;   ll gcd(ll a, ll b) {     if (a == 0 or b == 0) return a + b;     return gcd(b, a % b);   }   ll sum(ll a, ll b) {     a += b;     a %= mod;     return a;   }   ll sub(ll a, ll b) {     a += mod - b;     a %= mod;     return a;   }   inline ll mul(ll a, ll b) {     if (a * b < mod) return a * b;     return a * b % mod;   }   inline ll pew(ll a, ll b) {     ll res = 1;     while (b) {       if (b & 1) res = mul(res, a);       a = mul(a, a);       b /= 2;     }     return res;   }   int parent[600001];   int rnk[600001];   int suk[600001];   void make_set(int v) {     parent[v] = v;     rnk[v] = 0;     suk[v] = 0;   }   int find_set(int v) {     if (v == parent[v]) return v;     return parent[v] = find_set(parent[v]);   }   void union_sets(int a, int b) {     a = find_set(a);     b = find_set(b);     if (a != b and (suk[a] * suk[b] == 0)) {       if (rnk[a] < rnk[b]) swap(a, b);       parent[b] = a;       if (rnk[a] == rnk[b]) ++rnk[a];       suk[a] += suk[b];     }   }   vector<ll> primes(ll cur) {     vector<ll> res;     if (cur <= 1) return res;     for (ll j = 2; j * j <= cur; j++) {       if (cur % j == 0) {         res.push_back(j);         while (cur % j == 0) {           cur /= j;         }       }     }     if (cur != 1) res.push_back(cur);     return res;   }   int main() {     ios_base::sync_with_stdio(false);     ll n;     cin >> n;     srand(35324);     vector<ll> kek(n);     for (int i = 0; i < n; i++) {       cin >> kek[i];     }     vector<ll> lul(n);     for (int i = 0; i < n; i++) {       lul[i] = kek[i];     }     random_shuffle(lul.begin(), lul.end());     ll bst = n;     for (int q = 0; q < n and q < 23; q++) {       ll cur = lul[q] - 1;       vector<ll> pr = primes(cur);       for (int j = 0; j < pr.size(); j++) {         ll p = pr[j];         ll cnt = 0;         for (int i = 0; i < n; i++) {           ll a = kek[i] % p;           if (kek[i] == a) {             cnt += p - a;           } else {             cnt += min(a, p - a);           }         }         bst = min(bst, cnt);       }       cur = lul[q];       pr = primes(cur);       for (int j = 0; j < pr.size(); j++) {         ll p = pr[j];         ll cnt = 0;         for (int i = 0; i < n; i++) {           ll a = kek[i] % p;           if (kek[i] == a) {             cnt += p - a;           } else {             cnt += min(a, p - a);           }         }         bst = min(bst, cnt);       }       cur = lul[q] + 1;       pr = primes(cur);       for (int j = 0; j < pr.size(); j++) {         ll p = pr[j];         ll cnt = 0;         for (int i = 0; i < n; i++) {           ll a = kek[i] % p;           if (kek[i] == a) {             cnt += p - a;           } else {             cnt += min(a, p - a);           }         }         bst = min(bst, cnt);       }     }     cout << bst << endl;   }   