#include<bits/stdc++.h>
using namespace std;
int main(){
  long n;
  cin >> n;
  vector<long>a(n);
  int i;
  long ans = 0;
  long const p = 1000000007;
  for(i=0;i<n;i++){
    cin >> a[i];
  }
  for(long bit = 1;bit<(1LL<<61);bit*=2){
    long bit1 = 0;
    for(i=0;i<n;i++){
      if((a[i]&bit)!=0)bit1++;
    }
    ans += (bit%p)*(bit1)%p*(n-bit1)%p;
    ans %= p;
  }

  cout << ans << endl;

}
