v#include <bits/stdc++.h>

#define F first 
#define S second

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

const int N = 300010, M = 62, mod = 1e9 + 7;

int n;
LL a[N];

int main()
{
	scanf("%d", &n);
	for (int i = 0; i < n; i ++ ) scanf("%lld", &a[i]);
	
	int res = 0;
	for (int i = 0; i < M; i ++ )
	{
		int one = 0, zero = 0;
		for (int j = 0; j < n; j ++ )
			if (a[j] & 1LL << i) one ++ ;
			else zero ++ ;
		res = ((LL)res + (1LL << i) % mod * (LL)one % mod * zero) % mod;
	}
	
	printf("%d\n", res);
    return 0;
}
