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

int main()
{
  int n;cin>>n;
  vector<long long> a(n);
  int i,j;
  for(i=0;i<n;i++)cin>>a.at(i);
  vector<long long> sum1(60,0);
  long long ans=0;
  for(i=0;i<60;i++)
  {
    for(j=0;j<n;j++)
    {
      if(((long long)1<<i)&a.at(j))sum1.at(i)++;
    }
  }
  long long ks=1;
  for(i=0;i<60;i++)
  {
    ans=(ans+sum1.at(i)*(n-sum1.at(i))*ks)%MOD;
    ks=(ks*2)%MOD;
  }
  cout<<ans%MOD<<endl;
}
