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

int main() {
    long long N, A[400000], cnt, ans = 0, mod = 1000000007;
    cin >> N;
    for (long long i = 0; i < N; ++i) {
        cin >> A[i];
    }

    for (long long i = 0; i < 60; ++i) {
        cnt = 0;
        for (int j = 0; j < N; ++j) {
            if (A[j] & 1) {
                ++cnt;
            }
            A[j] = A[j] >> 1;
        }
        ans += ((cnt * (N - cnt)) % mod * (pow(2, i) % mod)) % mod;
    }

    cout << ans % mod << endl;
    
    return 0;
}