#include <bits/stdc++.h>

using namespace std;

#define int long long

const int mod = 1e9 + 7;
int nr[100];

main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	
	int n;
	cin >> n;
	
	for(int i = 1; i <= n; i++)
	{
		int x;
		cin >> x;
		
		int bit = 0;
		
		while(x)
		{
			if(x & 1)
			{
				nr[bit]++;
			}
			
			x /= 2;
			bit++;
		}
	}
	
	int res = 0;
	
	for(int i = 0, bit = 1; i <= 61; i++, bit = (bit * 2) % mod)
			res = (res + (bit * (n - nr[i]) * nr[i]) % mod) % mod;
	
	cout << res;
}