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

int main(){
    ll n;cin>>n;
    vector<ll> arr(n);
    for(int i = 0; i < n; i++) cin>>arr[i];
    
    ll ans = 0;
    for(int i = 0; i < 60; i++){
        ll cnt = 0;
      for(int j = 0; j < n; j++) if((arr[j]>>i)&1) cnt++;
       ll x = cnt*(n-cnt)%M;
      for(int j = 0; j < i; j++) x=x*2%M;
      ans+=x;
      ans%=M;
     }     
   cout<<ans;
}
