#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 1e+9 + 7;

int main(){
 ll n;
  cin >> n;
  ll a[n];
  ll suma = 0;
  for(int i = 0;i<n;++i){
    cin >> a[i];
    suma += a[i];
  }
  
  ll sum = 0;
  
  for(int i = 0;i<60;++i){
    ll x = 0;
    for(int j = 0;j<n;++j){
      if((a[j] >> i) & 1) ++x;
    }
    
    sum += ((x*(n-x))%mod) * ((1ll << i)%mod);
  }
  ll ans = sum%mod;
  cout << ans << endl;
}