#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
  const ll mod = 1e9+7;
  ll n;
  cin >> n;
  vector<ll> a(n);
  for(ll i=0; i<n; i++) cin >> a[i];
  
  vector<ll> b(60, 0);
  for(ll i=0; i<n; i++){
  	for(ll j=0; j<60; j++){
      if(a[i] & ((ll)1<<j)) b[j]++;
    }
  }
  
  ll ans = 0;
  ll coeff = 1;
  for(ll i=0; i<60; i++){
  	ans += (b[i]*(n-b[i])*coeff)%mod;
    coeff *= 2;
    coeff %= mod
    ans = ans%mod;
  }
  cout << ans << endl;
}