func_code_string: #include <bits/stdc++.h>   using namespace std;   pair<long long, long long> add_pair(pair<long long, long long> a,                                       pair<long long, long long> b) {     return make_pair(a.first + b.first, a.second + b.second);   }   long long power(long long a, long long b) {     long long res = 1;     a = a % ((long long)1e9 + 7);     while (b > 0) {       if (b & 1) {         res = (res * a) % ((long long)1e9 + 7);         b--;       }       a = (a * a) % ((long long)1e9 + 7);       b >>= 1;     }     return res;   }   long long fermat_inv(long long y) { return power(y, ((long long)1e9 + 7) - 2); }   long long gcd(long long a, long long b) { return (b == 0) ? a : gcd(b, a % b); }   long long mul(long long a, long long b) {     return (a * (b % ((long long)1e9 + 7))) % ((long long)1e9 + 7);   }   long long sub(long long a, long long b) {     return ((a - b) % ((long long)1e9 + 7) + ((long long)1e9 + 7)) %            ((long long)1e9 + 7);   }   long long add(long long a, long long b) {     return ((a + b) % ((long long)1e9 + 7) + ((long long)1e9 + 7)) %            ((long long)1e9 + 7);   }   vector<vector<int> > G;   int n, ans;   void bfs(int rt) {     int x;     queue<int> q;     vector<int> d(n), par(n);     vector<bool> vis(n, false);     d[rt] = 0;     par[rt] = rt;     q.push(rt);     while (!q.empty()) {       x = q.front();       vis[x] = true;       q.pop();       for (auto it = (G[x]).begin(); it != (G[x]).end(); it++) {         if (!vis[*it]) {           d[*it] = d[x] + 1;           par[*it] = x;           vis[*it] = true;           q.push(*it);         } else {           if (*it != par[x] && par[*it] != x) {             ans = min(ans, d[x] + d[*it] + 1);             if (ans == 3) return;           }         }       }     }   }   void solve() {     int i, j;     long long x;     cin >> n;     vector<long long> a;     vector<int> cnt(61, 0ll);     for (i = (0); i < (n); i += (1)) {       cin >> x;       if (x == 0) continue;       a.push_back(x);       for (j = 0; j < 61; j++) {         if (x & (1ll << j)) {           cnt[j]++;         }       }     }     for (i = (0); i < (61); i += (1)) {       if (cnt[i] > 2) {         cout << 3 <<   n ;         return;       }     }     n = (a).size();     G = vector<vector<int> >(n, vector<int>());     ans = n + 1;     for (i = (0); i < (n); i += (1)) {       for (j = (0); j < (i); j += (1)) {         if (a[i] & a[j]) {           G[i].push_back(j);           G[j].push_back(i);         }       }     }     for (i = (0); i < (n); i += (1)) {       bfs(i);       if (ans == 3) break;     }     if (ans == n + 1)       cout << -1 <<   n ;     else       cout << ans <<   n ;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     long long t;     t = 1;     while (t--) {       solve();     }     return 0;   }   