#include <bits/stdc++.h>
int main() {
  int n;
  scanf("%d", &n);
  int i, j;
  long long int a[300005];
  for (i = 0; i < n; i++) scanf("%lld", &a[i]);
  int b[300005][62];
  for (i = 0; i < n; i++) {
    for (j = 0; j < 62; j++) {
      b[i][j] = (int)(a[i] % 2);
      a[i] /= 2;
    }
  }
  long long int ans = 0;
  long long int c0, c1, q = 1;
  long long int p = 1000000007;
  for (j = 0; j < 62; j++) {
    c0 = c1 = 0;
    for (i = 0; i < n; i++) {
      if (b[i][j] == 0)
        c0++;
      else
        c1++;
    }
    ans = (ans + q * c0 * c1) % p;
    q *= 2;
  }
  printf("%lld\n", ans);
  return 0;
}
