#include<bits/stdc++.h>
#define mod 10e9+7
#define ll long long unsigned int
using namespace std;
vector<ll>input;
int main()
{
  ll n;
  scanf("%d",&n);
  for(ll i=0;i<n;i++)
  {
    ll num;
    scanf("%lld",&num);
    input.emplace_back(num);
  }
  int i,j,k;
  ll ans=0;
      for(i=0;i<64;i++)
    {
        k=0; // k is the number of set bits in the array at ith psotion
        for(j=0;j<n;j++)
            if((input[j] & (1<<i)))
                k++;
        /* there are k set bits and n-k unset bits.
            therefore number of pairs with one set bit and one unset bit is kC1 and n-kC1
            Every pair adds 2^i in the answer.
        */
        ans+= ((1<<i)*(k*(n-k)))%mod;     
    }
  printf("%lld\n",ans);
  return 0;
}