func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 4e5 + 7;   int n, a[N], cnt[N], lim = 0, mx = 0, fa[N];   long long ans = 0;   inline int find(int x) { return x == fa[x] ? x : fa[x] = find(fa[x]); }   inline void merge(int u, int v, long long w) {     if (cnt[u] && cnt[v]) {       u = find(u), v = find(v);       if (u != v) {         ans += 1ll * w * (cnt[v] + cnt[u] - 1);         fa[u] = v;         cnt[v] = 1;       }     }   }   int main() {     scanf( %d , &n);     cnt[0] = 1;     for (int i = 1; i <= n; i++) {       scanf( %d , &a[i]);       cnt[a[i]]++;       mx = max(mx, a[i]);       ans -= a[i];     }     lim = 1 << 32 - __builtin_clz(mx);     for (int i = 0; i <= lim - 1; i++) fa[i] = i;     for (int i = lim - 1; ~i; i--) {       for (int j = i; j; j = (j - 1) & i) {         if (cnt[j] && cnt[i ^ j]) merge(j, i ^ j, i);       }       merge(i, 0, i);     }     printf( %lld n , ans);     return 0;   }   