#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n); i >= 0; i--)
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = unsinged long long;
const int MOD = 1e9 + 7;
int main() {
    ll N;
    vector<ll> A;
    cin >> N;
    REP(i, N) {
        ll a;
        cin >> a;
        A.push_back(a);
    }

    ll ans;
    REP(i, 63) {
        ll zc, oc;
        zc = oc = 0;
        REP(j, N) {
            if (A[j] % 2 == 0) {
                zc++;
            } else {
                oc++;
            }
            A[j] /= 2;
        }
        ans = (ans + ((zc * oc) << i) % MOD) % MOD;
    }

    cout << ans << endl;

    return 0;
}
