#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;

int main(){
  int n; cin>>n;
  vector<ll> num(n);
  for(int i=0;i<n;i++){
    cin>>num[i];
  }
  
  ll ans=0;
  for(int i=0;i<61;i++){
    ll c0=0,c1=0;
    for(int j=0;j<n;j++){
      if(num[j]%2==0){
        c1++;
      }else{
        c0++;
      }
      num[j]/=2;
    }
    ans+=(c0*c1)%MOD)*(1<<i)%MOD;
    ans%=MOD;
  }
  
  cout<<ans<<endl;
}