#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <bitset>
using namespace std;

const int MOD = 1e9 + 7;

long long mod_pow(int a, int n) {
    long long r = 1;
    for (int i = 0; i < n; i++) {
        r = (r * a) % MOD;
    }
    return r;
}

int main() {
    int N; cin >> N;
    vector<long long> As(N);
    vector<pair<int, int> > Keta(62, {0, 0});
    for (int i = 0; i < N; i++) {
        cin >> As[i];
        std::stringstream ss;
        ss << std::bitset<62>(As[i]);
        std::string s = ss.str();
        reverse(s.begin(), s.end());
        for (int j = 0; j < 62; j++) {
            if (s[j] - '0' == 0) {
                Keta[j].first++;
            } else {
                Keta[j].second++;
            }
        }
    }
    
    long long ans = 0;
    for (int i = 0; i < 60; i++) {
        ans = (ans + mod_pow(2, i) * ((Keta[i].first * Keta[i].second) % MOD)) % MOD;
    }
    cout << ans << endl;
}
