##define INF 0x7f7f7f ##define mem(a,b) memset(a , b , sizeof(a)) ##define FOR(i, x, n) for(int i = x;i <= n; i++) const ll mod = 1e9 + 7; // const int maxn = 100005;
ll FPM(ll a, ll b) { ll ans = 1; while(b) { if(b & 1) { ans = ans * a % mod; } a = a * a % mod; b >>= 1; } return ans % mod; }
ll C(ll n, ll m) { if(n < m) return0; ll ans = 1; for(ll i = 1;i <= m; i++) { ans = (ans % mod * (n - i + 1) % mod * FPM(i, mod - 2) % mod) % mod; } return ans % mod; }
ll XOR[64];
voidsolve() { ll n; cin >> n; for(int i = 0;i < n; i++) { ll x; cin >> x; ll k = 0; while(x) // 二进制下的每一位的1储存下来,N-t[i]就是0的个数 { if(x&1) XOR[k]++; k++; x >>= 1; } } ll sum = 0; ll k = 1; for(ll i = 0;i < 64; i++) { sum = (sum % mod + k * (C(XOR[i], 3) % mod + XOR[i] % mod * C(n - XOR[i], 2) % mod) % mod) % mod; sum %= mod; k = (k << 1) % mod; } cout << sum % mod; }
signed main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); ##ifdef FZT_ACM_LOCAL freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout); ##else ios::sync_with_stdio(false); int T = 1; //cin >> T; while(T--) solve(); ##endif return0; }