#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(int)(n); i++)

using namespace std;
typedef long long LL;
const LL mod=1000000007;
const int Max_Num=300010;

int main(){
	int N;
	cin >> N;
	LL A[Max_Num];
	rep(i,N) cin >> A[i];
	LL ans=0;
	rep(bit,61){
		int one=0;
		rep(i,N){
			if(1LL<<bit&A[i]) one++;
		}
		LL m=1;
		rep(i,bit){
			m*=2;
			m%=mod;
		}
		ans+=m*one%mod*(N-one);
      	ans%=mod;
	}
	cout << ans << endl;

  return 0;
}
