#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MOD=1e9+7;

signed main(){
  int n;cin>>n;
  vector<int> v(n);
  for(int i=0;i<n;i++)cin>>v[i];
  int ans=0;
  for(int j=0;j<60;j++){
    int cnt=0;
    for(int i=0;i<n;i++)cnt+=v[i]&1,v[i]>>=1;
    ans+=cnt*(n-cnt)%MOD*((1LL<<j)%MOD)%MOD;ans%=MOD;
  }
  cout<<ans<<endl;
}
