#include<bits/stdc++.h>
using namespace std;
int X[62][2];
const int mod=1000000007;
int main()
{
	long long ans=0;
	int N;
	cin>>N;
	while(N--)
	{
		long long A;
		cin>>A;
		long long B=A;
		for(int i=0;i<60;i++)
			ans=(ans+X[i][(int)(1ll-(B%2ll))])%mod,
			B/=2ll;
		for(int i=0;i<60;i++)
			X[i][(int)(A%2ll)]=(X[i][(int)(A%2ll)]+(1ll<<i))%mod,
			A/=2ll;
	}
	cout<<ans<<endl;
}