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

const int mod = 1e9+7;

int main() {
  int n;
  cin>>n;
  vector<ll> a(n);
  rep(i,n) cin>>a[i];
  ll ans = 0;
  ll p = 1;
  rep(i,60){
    ll res = 0;
    rep(j,n){
      if((a[j]>>i)&1) res++;
    }
    ans += ((res*(n - res))%mod*p)%mod;
    ans %= mod;
    p = (p*2)%mod;
  }
  cout << ans << endl;
}