#include <bits/stdc++.h>
static const long long MOD_NUM = 1000000007;
template <class _T>
static void getint(_T& a) {
  const char* fmt = " %d";
  if (sizeof(_T) == sizeof(long long)) {
    fmt = " %lld";
  }
  if (scanf(fmt, &a) < 0) {
    printf("g1int Error\n");
  }
}
template <class _T>
static void getint(_T& a, _T& b) {
  const char* fmt = " %d %d";
  if (sizeof(_T) == sizeof(long long)) {
    fmt = " %lld %lld";
  }
  if (scanf(fmt, &a, &b) < 0) {
    printf("g2int Error\n");
  }
}
template <class _T>
static void getint(_T& a, _T& b, _T& c) {
  const char* fmt = " %d %d %d";
  if (sizeof(_T) == sizeof(long long)) {
    fmt = " %lld %lld %lld";
  }
  if (scanf(fmt, &a, &b, &c) < 0) {
    printf("g3int Error\n");
  }
}
static void ABC147D();
int main() {
  ABC147D();
  fflush(stdout);
  return 0;
}
static void ABC147D() {
  int N;
  getint(N);
  std::vector<long long> an(N, 0);
  for (int i = 0; i < N; i++) {
    getint(an[i]);
  }
  long long ans = 0;
  long long bit = 1, two_factor = 1;
  for (int shift = 0; shift <= 60; shift++) {
    bit = 1LL << shift;
    long long one = 0, zero = 0;
    for (int i = 0; i < N; i++) {
      if (an[i] & bit) {
        one++;
      } else {
        zero++;
      }
    }
    ans = (ans + ((one * zero % MOD_NUM) * two_factor) % MOD_NUM) % MOD_NUM;
    two_factor *= 2LL;
  }
  printf("%lld\n", ans);
}
