///Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>
#define int long long
#define ll long long
using namespace std;
const int mod=1e9+7;
ll ad(ll x,ll y)
{
    ll ret;
    ret=(x%mod)+(y%mod);
    if(ret<0)ret+=mod;
    ret=ret%mod;
    return ret;
}
inline bool checkBit(ll n, int i) { return n&(1LL<<i); }

ll mult(ll a, ll b) {
ll ret = a*b;
if(ret >= mod) ret %= mod;
return ret;
}
int o[70],z[70];
main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n,x;
  cin>>n;
  for(int i=0;i<n;i++)
  {
      cin>>x;
      for(int j=0;j<=61;j++)
      {
          if(checkBit(x,j))o[j]++;
          else z[j]++;
      }
  }
   int ses=0;
   for(int i=0;i<=61;i++)
   {
       ses=ad(ses,mult(z[i]*o[i],(1LL<<i)));
   }
   cout<<ses<<endl;

return 0;
}












































