#include <bits/stdc++.h>
long int f(long int x, long int p) {
  long int y;
  y = (x / p) % 2;
  return y;
}
int main(void) {
  long int N, A[300001], i, j;
  scanf("%ld\n", &N);
  for (i = 1; i <= N; i++) {
    scanf("%ld", &A[i]);
  }
  long int t[61];
  t[0] = 1;
  for (j = 1; j <= 60; j++) {
    t[j] = 2 * t[j - 1];
  }
  long int s[61], a[61], b[61];
  for (j = 0; j <= 60; j++) {
    s[j] = 0;
    for (i = 1; i <= N; i++) {
      s[j] = s[j] + f(A[i], t[j]);
    }
    a[j] = (s[j] * (N - s[j])) % 1000000007;
    b[j] = (a[j] * t[j]) % 1000000007;
  }
  long int X;
  X = 0;
  for (j = 0; j <= 60; j++) {
    X = (X + b[j]) % 1000000007;
  }
  printf("%ld", X);
  return 0;
}
