#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;

typedef long long ll;

int main() {
    int N;
    cin >> N;
    ll A, MOD = 1e9 + 7, ans = 0;
    vector<int> c(60, 0);
    rep(i, N) {
        cin >> A;
        rep(j, 60) {
            if (A & (1LL << j)) c[j]++; 
        }
    }
    rep(i, 60) {
        ans = (ans + ((((1LL << i) % MOD) * c[i]) % MOD) * (N - c[i])) % MOD;
    }
    cout << ans << "\n";
}