#include <bits/stdc++.h>
int main() {
  int MOD = 1000000000 + 7;
  int n;
  scanf("%ld", &n);
  int b[60];
  for (int j = 0; j < 60; j++) {
    b[j] = 0;
  }
  for (int i = 0; i < n; i++) {
    long a;
    scanf("%ld", &a);
    for (int j = 0; j < 60; j++) {
      b[j] += a % 2;
      a /= 2;
      if (a == 0) break;
    }
  }
  long sum = 0;
  for (int j = 0; j < 60; j++) {
    long c = pow((double)2, (double)j);
    c %= MOD;
    sum += b[j] * (n - b[j]) * c % MOD;
    sum %= MOD;
  }
  printf("\n");
  printf("%d", sum);
  return 0;
}
