#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define f first
#define s second
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define bcount __builtin_popcount
#define mbit __builtin_ctz
#define pb push_back
using namespace std;
using namespace __gnu_pbds;
typedef tree<long,null_type,less<long>, rb_tree_tag,tree_order_statistics_node_update> indexed_set;
const long long mod=1e9+7;
typedef long long ll;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	ll b,c,d,i,l,r,j;
	ll ans=0;
	cin>>b;
	vector<ll> arr(b);
	for(i=0;i<b;i++)
    {
        cin>>arr[i];
    }
    for(i=0;i<60;i++)
    {
        vector<ll> mas(2,0);
        for(j=0;j<b;j++)
        {
            if(arr[j]&(1LL<<i)) mas[1]++;
            else mas[0]++;
        }
        ll cnt=mas[0]*mas[1];
        ans+=(cnt*(1LL<<i))%mod;
    }
    cout<<ans%mod;
	return 0;
}
