#include <bits/stdc++.h>
#define ll long long 
using namespace std;

int main(){
  ll N;
  const ll mod=pow(10,9)+7;
  vector<ll> A;
  ll sum=0;
  cin >> N;

  for(int i=0;i<N;i++){
    ll input;
    cin >> input;
    A.push_back(input);
    }
  
  for(int bit=0;bit<=60;bit++){
    ll ones=0;
    vector<ll> v=A;
    for(int i=0;i<v.size();i++){
      ll a=v.back();
      a = v.pop_back();
      if((a&(1<<bit))!=0) ones++;
    }
    sum = (sum+(1LL<<bit)%mod*ones%mod*(N-ones)%mod)%mod;
  }
  cout << sum << endl;
  return 0;
}