#include <bits/stdc++.h>
using namespace std;
const unsigned long long BIGEST = 1000000000000000000 + 1000000000000000000;
const long long BIGER = 1000000000000000000;
const int BIG = 1000000000;
const long long MOD = 19961993;
const long long LMOD = 1000000007;
long long a[300001];
int main() {
  long long n;
  scanf("%lld", &n);
  for (long long i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
  }
  long long s = 0;
  long long g = 0;
  for (long long i = 0; i < 60; i++) {
    g = 0;
    for (long long j = 1; j <= n; j++) {
      g += (a[j] >> i) & 1l;
    }
    for (long long j = 1; j <= n; j++) {
      if (((a[j] >> i) & 1ll))
        (s += (1ll << i) * (n - g)) %= LMOD;
      else
        (s += (1ll << i) * g) %= LMOD;
    }
  }
  cout << (s * ((LMOD + 1) / 2)) % LMOD;
  return 0;
}
