#include <bits/stdc++.h>
using namespace std;
#define int long long
const long long MOD = 1e9+7;
const long long B = 61;

signed main() {
    int N;
    cin >> N;
    vector<long long> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    vector<vector<bool>> bit(N, vector<bool>(B));
    for (long long i = 0; i < N; i++) {
        for (long long j = 0; j < B; j++) {
            bit[i][j] = (A[i]&(1LL<<j));
        }
    }
    
    long long ans = 0;
    long long two = 1;
    for (int j = 0; j < B; j++) {
        int one = 0, zero = 0;
        for (int i = 0; i < N; i++) {
            if (bit[i][j]) one++;
            else zero++;
        }
        /*
        if (j == 33) cout << one << " " << zero << endl;
        cout << j << "bit is " << ans << endl;
        */
        long long res = ((two * one)%MOD) * zero) % MOD;
        ans += res;
        ans %= MOD;
        two *= 2LL;
        two %= MOD;
    }
    
    cout << ans%MOD << endl;
    return 0;
}