#include <bits/stdc++.h>
long long in() {
  long long n = 0;
  int c;
  do c = getchar_unlocked();
  while (isspace(c));
  do n = 10 * n + (c & 0xf);
  while ((c = getchar_unlocked()) >= '0');
  return n;
}
int N;
long long A[300005];
int main() {
  int i, b, n;
  long long ans, a;
  N = (int)in();
  for (i = 0; i < N; ++i) A[i] = in();
  ans = 0;
  b = 61;
  while (b--) {
    n = 0, i = N;
    while (i--) {
      if ((A[i] >> b) & 1) ++n;
    }
    a = (long long)n * (N - n) % 1000000007;
    ans = (ans + (a << b)) % 1000000007;
  }
  printf("%d\n", (int)ans);
  return 0;
}
