#include <bits/stdc++.h>
int main(void) {
  int n, i, j, x[62];
  long long mod = 1000000007, sum = 0, bin = 1;
  scanf("%d", &n);
  long long a[n];
  for (i = 0; i < n; i++) scanf("%lld", &a[i]);
  for (i = 0; i < 62; i++) x[i] = 0;
  for (i = 0; i < n; i++) {
    for (j = 0; j < 62; j++) {
      if (a[i] & 2 != 0) x[j]++;
      a[i] /= 2;
    }
  }
  for (i = 0; i < 62; i++) {
    sum = (sum + x[i] * (n - x[i]) * bin) % mod;
    bin = bin * 2 % mod;
  }
  printf("%lld", sum);
}
