#include <bits/stdc++.h>
#include <cstring>
#include <tuple>
#define ll  long long
#define endl '\n'
const ll mod = 1000000007;
const double PI = 3.141592653589793238463;
const long long INF = 1e18L + 5; // 10^18
#define fastIN  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int main()
{
  fastIN
   //   freopen("input.in","r",stdin);

    int y;
    cin>>y;
    ll a[y];
    ll sum=0;
    for (ll i=0;i<y;i++){
        cin>>a[i];
    }
    for (ll i=0;i<64;i++){
        ll e=0,o=0;
        ll p=0;
        for (ll j=0;j<x;j++){
             if (a[j]%2==0) 
                e++; 
            else
                o++; 
            a[j]/= 2; 
        }
        ll t=((o*e)+mod)%mod;
      ll q=(((ll)1<<i)+mod)%mod;
        p=((t*q)+mod)%mod;
        sum=(sum+p+mod)%mod;
    }
    cout<<sum<<endl;
    return 0;
}