#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
const long long MOD = 1000000007;
const long long INF = 9999999999999999;
using ll = long long;
ll two[70];

vector <ll> binary(ll bina){
    vector <ll> ans;
    for (ll i = 0; bina>0;i++)
    {
        ans.push_back((bina%2));
        bina = bina/2;
    }
    return ans;
}

int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
  for(ll i = 0;i<62;i++){
    two[i] = 0;
  }
  ll N;
  cin>>N;
  ll kazu[N];
  for(ll i = 0;i<N;i++){
    cin>>kazu[i];
  }
  for(ll i = 0;i<N;i++){
    vector <ll> tow = binary(kazu[i]);
    for(ll k = 0;k<tow.size();k++){
      if(tow[k] == 1){
        two[k]++;
      }
    }
  }
  ll ans = 0;

  
  
  for(ll i = 0;i<70;i++){
    ll temp = pow(2,i)%MOD;
    ans += (N-two[i])*two[i]%MOD*temp%MOD;
    ans = ans%MOD;
  }
  cout << ans << endl;
  return 0;
}
