#include <bits/stdc++.h>
long long a[300010];
int main() {
  int n, i, j;
  long long res = 0, d = 1;
  scanf("%d", &n);
  for (i = 0; i < n; i++) scanf("%lld", &a[i]);
  for (j = 0; j < 60; j++) {
    int c = 0;
    for (i = 0; i < n; i++) {
      if (a[i] & 1) c++;
      a[i] >>= 1;
    }
    res += (((c * (n - c)) % (long long)(1e9 + 7)) * d) % (long long)(1e9 + 7);
    d *= 2;
    d %= (long long)(1e9 + 7);
  }
  printf("%lld\n", res % (long long)(1e9 + 7));
}
