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

using ll = long long;

signed main(){

  int n;
  cin>>n;
  vector<ll> bit0(64),bit1(64);
  for(int i=0;i<n;++i){
    ll a;
    cin>>a;
    for(int b=0;b<64;++b){
      if(a&(1LL<<b))bit1[b]++;
      else bit0[b]++;
    }
  }

  ll ans = 0;
  ll MOD = 1e9+7;
  for(int i=0;i<64;++i){
    ans += (1LL<<i)%MOD*bit1[i]%MOD*bit0[i]%MOD;
    ans %= MOD;
  }
  cout<<(ans)<<endl;

}