#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll M = 1e9 + 7;
ll n,c[60];
int main()
{
    cin >> n;
    for (ll i = 0; i < n; ++i) {
        ll a;
        cin >> a;
        for (int j = 0; j < 60; ++j)
            if (a >> j & 1)
                c[j]++;
    }
    ll ans = 0;
    ll p = 1;
    for (int i = 0; i < 60; ++i,  p = 2 * p % M)
        ans += c[i] * (n - c[i]) % M * p % M;
    cout << ans % M << endl;
}
