#include<bits/stdc++.h>
using namespace std;
int A[60],n;
const int MOD = 1e9+7;
long long ans;
int main(){
  cin >> n;
  for (int i = 0; i < n; i++){
  	long long a;
  	cin >> a;
  	for (int  j = 0; (1LL << j) <= a; j++)
  		if ((1LL << j) & a)
  		A[j]++;
  }
  for (int i = 0;i < 60; i++)
  ans = (ans + 1ll*A[i]*(n-A[i])%MOD*((1LL<<i)%MOD)%MOD)%MOD;
  cout << ans;
  return 0;
}