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

ll X=1000000007;

int main() {
  ll N;
  cin>>N;
  vector<bitset<60>> A(N);
  for(ll i=0;i<N;i++){
    ll a;
    cin>>a;
    bitset<60> p(a);
    A.at(i)=p;
  }
  ll Ans=0;
  for(ll i=59;i>=0;i--){
    ll count=0;//i桁目が1の個数を数える
    for(ll j=0;j<N;j++){
      if(A.at(j).test(i)==1){count++;}
    }
    Ans*=2;
    Ans%=X;
    Ans+=count*(N-count)%X;
    Ans%=X;
  }
  cout<<Ans<<endl;
}


