#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

const ll mod = 1000000007;
int cb[60][2];

int main() {
    int n; cin >> n;
    for (int i = 0; i < n; i++) {
        ll v; cin >> v;
        for (int j = 0; j < 60; j++)
            cb[j][(v >> j) & 1]++;
    }
    ll ans = 0;
    for (int i = 0; i < 60; i++)
        ans = (ans + (1ll << i) % mod * cb[i][0] % mod * cb[i][1]) % mod;
    cout << ans << endl;
}