#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
int main()
{
    ll n;
    cin >> n;
    vector<ll> a(n);
    vector<vector<int>> binary(60, vector<int>(60, 0));
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    for (int i = 0; i < n; i++)
    {
        ll b = a[i];
        int j = 0;
        while (b > 0)
        {
            binary[i][j] = b % 2;
            b /= 2;
            j++;
        }
        reverse(binary[i].begin(), binary[i].end());
    }
    vector<ll> zeros(60), ones(60);
    for (int i = 0; i < 60; i++)
    {
        for (int j = 0; j < n; j++)
        {
            binary[j][i] == 0 ? zeros[i]++ : ones[i]++;
        }
    }
    ll k = pow(2, 60);
    ll conbi = 0;
    for (int i = 0; i < 60; i++)
    {
        k /= 2;
        ll o = k % MOD;
        conbi += (o * zeros[i] * ones[i]) % MOD;
        conbi %= MOD;
    }
    cout << conbi << endl;
}