#include<bits/stdc++.h>
#define int long long
#define md 1000000007
using namespace std;
int power(int x,int y, int p) 
{ 
   int res = 1;     
  
    x = x % p;  // Update x if it is more than or 
                // equal to p 
  
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res*x) % p; 
  
        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x) % p; 
    } 
    return res; 
} 
main()
{
	//freopen("input.txt","rt",stdin);
	int n;
	cin>>n;
	int arr[n];
	vector<string>ma;
	for(int i=0;i<n;i++)
	{
		cin>>arr[i];
		string binary = bitset<61>(arr[i]).to_string();
		ma.push_back(binary);
	}
	int p =0;
	int ans =0;
	for(int i= 60;i>=0;i--)
	{
		int z = 0;
		int o = 0;
		for(int j=0;j<n;j++)
		{
			if(ma[j][i] == '0')
			{
				z++;
			}
			else
			{
				o++;
			}
		}
		int t = 2;
		int p = (z * o) % md;
		ans = ans + (p *power(t,p,md) % md);
		ans %= md;
		p++;
	}
	ans %= md;
	cout<<ans<<endl;
}