#include <bits/stdc++.h>
using namespace std;
long long a[300000];
int main(void) {
  int n, i, j, c[61];
  long long sum, mask, s2, x;
  scanf("%d", &n);
  for (i = 0; i < n; i++) scanf("%lld", &a[i]);
  mask = 1;
  for (i = 0; i < 60; i++) {
    c[i] = 0;
    for (j = 0; j < n; j++) {
      x = a[j] & mask;
      if (x != 0) c[i]++;
    }
    mask *= 2;
  }
  mask = 1;
  sum = 0;
  for (i = 0; i < 60; i++) {
    x = mask % 1000000007;
    sum += x * c[i] * (n - c[i]);
    sum %= 1000000007;
    mask *= 2;
  }
  printf("%lld\n", sum);
  return 0;
}
