#include<bits/stdc++.h>
using namespace std;
typedef int64_t LL;
#define rep(i,N) for(int i=0;i<(int)N;i++)
const int MOD=1e9+7;
int main()
{
  int N,pos=0;
  LL A=0,one=0,two=1;
  cin>>N;
  vector<LL> x(N,0);
  rep(i,N){cin>>x.at(i);if(x.at(pos)<x.at(i))pos=i;}
  while(x.at(pos)>0)
  {
    one=0;
    rep(i,N)one+=x.at(i)%2==1,x.at(i)/=2;
    A=(A+((N-one)*one%MOD)*two%MOD)%MOD;two=2*two%MOD;
  }
  return cout<<A<<endl,0;
}