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