#include <iostream>
int main(){
  int n, inf=1000000007,b;
  long long a,ans=0,tmp,oc[61]={},zc[61]={};
  std::cin>>n;
  for(int i=0;i<n;++i){
    std::cin>>a;
    b=0;
    while(true){(a>>b&1?++oc[b]:++zc[b]);if(a>>b==0)break;++b;}
  }
  for(int i=0;i<61;++i){
    tmp = (oc[i]*(n-oc[i]))%inf;
    for(int j=0;j<i;++j)tmp=tmp*2%inf;
    ans+=tmp%inf;
  }
  std::cout<<ans%inf<<"\n";
}