#include <iostream>
#define rep(i, n) for(i = 0; i < n; i++)
#define int long long
using namespace std;

int mod = 1000000007;
int n;
int a[300000];

signed main() {
	int i, j;
	
	cin >> n;
	rep(i, n) cin >> a[i];
	
	int ans = 0;
	rep(i, 60) {
		int one = 0;
		rep(j, n) if ((a[j] >> i) & 1) one++;
		int zero = n - one;
		int res = zero * one % mod;
		
		ans += ((1LL << i) % mod) * res % mod;
		ans %= mod;
	}
	
	cout << ans << endl;
	return 0;
}