#include<bits/stdc++.h>
using namespace std;
#define ll unsigned long long int
ll arr[500009];
ll sumXOR(ll n)
{
    ll sum1 = 0;
    for(ll i = 0; i <61; i++)
    {
        ll zc = 0, oc = 0;
        ll idsum = 0;
        for (ll j=0; j<n; j++)
        {
            if(arr[j]%2==0)
            {
                zc++;
            }
            else
            {
                oc++;
            }
            arr[j]/=2;
        }
        idsum =(oc*zc*((1ll<<i)%1000000007))%1000000007;

        sum1=(sum1+idsum)%1000000007;
    }
    return sum1;
}

int main()
{
    ll sum = 0,n;
    cin>>n;
    for(ll i=0; i<n; i++)
    {
        cin>>arr[i];
    }
    sum = sumXOR(n);
    cout << sum;
    return 0;
}
