#include<bits/stdc++.h>
#define int long long
#define md (long long)1e9+7
using namespace std;
template <typename T>
T modpow(T base, T exp, T modulus) {
  base %= modulus;
  T result = 1;
  while (exp > 0) {
    if (exp & 1) result = (result * base) % modulus;
    base = (base * base) % modulus;
    exp >>= 1;
  }
  return result;
}
main()
{
	int n;
	cin>>n;
	int arr[n];
	vector<string>ma;
	for(int i=0;i<n;i++)
	{
		cin>>arr[i];
		string binary = bitset<60>(arr[i]).to_string();
		//cout<<binary<<endl;
		ma.push_back(binary);
	}
	int p =0;
	int ans =0;
	for(int i= 59;i>=0;i--)
	{
		int z = 0;
		int o = 0;
		for(int j=0;j<n;j++)
		{
			//cout<<ma[j]<<endl;
			if(ma[j][i] == '0')
			{
				z++;
			}
			else
			{
				o++;
			}
		}
		int t = 2;
	//	cout<<z<<" "<<o<<" "<<modpow(t,p,md)<<endl;
		//cout<<z*o*modpow(t,p,md)<<endl;
//		int y = (z * o)%md;
//		y = (y%md * modpow(t,p,md))%md;
		ans = ans + (z*o*modpow(t,p,md))%md;
		ans %= md;
	//	cout<<"ans "<<ans<<endl;
		p++;
	}
	ans %= md;
	cout<<ans<<endl;
}