#include <bits/stdc++.h>
#define r(i,n) for(long long i = 0; i<n; i++)
typedef long long ll;
using namespace std;

const ll mod=1000000007;

int main() {
  int n;
  cin >> n;
  vector<ll> v(n);
  r(i,n)cin >> v[i];
  ll ans=0,kisuu=1;
  r(i,60){
    ll count=0;
    r(j,n)if(v[j]>>i&1)count++;
    ll tasu=count*(n-count)%mod;
    ans+=(tasu*kisuu)%mod;
    ans%=mod;
    kisuu=kisuu*2%mod;
  }
  cout<<ans<<endl;
}