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

const int MOD =1e9+7;

int main(){
  long N;
  cin >> N;
  vector<long> one(61,0);
  for(long i=0; i<N; i++){
    long a; cin >> a;
    for(long j=0; j<=60; j++){
      if(a&1) one[j]++;
      a >>= 1;
    }
  }
  long ans=0, p=1;
  for(long i=0; i<=60; i++){
    ans = (ans + (((p<<i)%MOD)*((one[i]*(N-one[i]))%MOD))%MOD)%MOD;
  }
  cout << ans << endl;
  return 0;
}