#include <iostream>
#include <vector>
#include <math.h>
#include <queue>
#include <map>
#include <math.h>

long long modpow(long long a, long long n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % MOD;
    a = a * a % MOD;
    n >>= 1;
  }
  return res;
}

int main(){
  long long N;
  scanf("%lld",&N);
  std::vector<long long >A(N+5, 0);
  long long maxvalue = 0;
  for (long long i=0; i<N; i++){
    scanf("%lld",&A[i]);
    maxvalue = fmax(maxvalue, A[i]);
  }
  long long mod = (long long)1e9+7;
  long long ans = 0;
  long long multiple = 1;

  int i=0;
  while(maxvalue>0){
    long long count = 0;
    for (long long j=0; j<N; j++){
      //if ((A[j] & 1) != 0){
      if ((A[j] % 2) == 1){
        count++;
      }
      A[j] /= 2;
    }
    maxvalue /= 2;
    //printf("count=%lld\n",count);
    ans += multiple * count * (N-count);
    ans %= mod;
    //multiple *= 2;
    multiple = modpow(2,i);
    multiple %= mod;
    //printf("ans=%lld\n",ans);
    i++;
  }
  printf("%lld\n",ans);
  return 0;
}