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

int main(){
  int N;
  cin>>N;
  vector<ll> A(N);
  for(int i=0;i<N;i++){
    cin>>A.at(i);
  }
  vector<ll> count(60,0);
  ll res=1;
  ll ans=0;
  for(int i=0;i<60;i++){
    for(int j=0;j<N;j++){
      count.at(i)+=A.at(j)%2;
      A.at(j)/=2;
    }
    ans+=(count.at(i)*(N-count.at(i))%MOD)*res%MOD;
    ans%=MOD;
    res*=2;
    res%=MOD;
  }
  cout<<ans<<endl;
}
