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

int main() {
  	int mod = 1000000007;
    int n;
    cin >> n;
    vector<uint64_t> a(n)
  	rep(i,n) cin >> a[i];
    vector<uint64_t>cnt1(60,0);
    for(uint64_t a_i : a){
        int j = 0;
        while(a_i > 0){
            if(a_i%2 == 1) cnt1[j]++;
            a_i /= 2;
            j++;
        }
    }
    vector<uint64_t> ans(60);
    rep(i,60){
        uint64_t cnt1_i = cnt1[i];
        ans[i] = cnt1_i*(n-cnt1_i)%mod;
    }
    uint64_t ANS = 0;
    for(int i = 59; i >= 0; i--){
        ANS = (2*ANS+ans[i])%mod;
    }
    cout << ANS << endl;
}