/*input
10
3 14 159 2653 58979 323846 2643383 27950288 419716939 9375105820
*/
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
typedef vector<int> vii;
typedef pair<int,int> pii;
#define F first
#define S second
#define pb push_back
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n,a;

void solve(){
	cin>>n;
	int a;
	int o[100]={0},z[100]={0};
	int ans =0;
	for(int i = 0; i<n;++i){
		cin>>a;
		for(int j=0;j<=60;++j){
			if((a>>j)&1){
				++o[j];
			}
			else
				++z[j];
		}
	}

	for(int i=0;i<=60;++i){
		int x= o[i]*z[i];
		x*= (1LL<<i)%(1000000007LL);
		ans+=x;
		ans%=(1000000007LL);
	}	
	cout<<ans<<endl;
}

signed main(){
	IOS
	int t=1;
	//cin>>t;
	while(t--)
		solve();
	return 0;
}