#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

int main(){
	ll n;
	cin >> n;
	vector<ll> a(n);
	for(int i = 0; i < n; i++) {
		cin >> a [i];
	}
	ll sum = 0;
	
	for(ll i = 0; i <= 61; i++) {
		ll one = 0;
		ll zero = 0;
		for(ll j = 0; j < n; j++) {
			if ((a[j] & (1LL<<i)){
				one += 1;
			}
			else{
				zero += 1;
			}
		}
		sum += (one * zero * ll(pow(2.0,float(i)))); 
		sum %= mod;
	}
	cout << sum % mod << endl;
	return 0;
}