#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
int main() {
  int n;
  scanf("%d", &n);
  long long a[n];
  for (int i = 0; i < n; i++) scanf("%lld", a + i);
  int xd[100];
  for (int i = 0; i < 62; i++) xd[i] = 0;
  for (int i = 0; i < n; i++) {
    for (int k = 0; k < 62; k++) {
      if (a[i] & (1LL << k)) xd[k]++;
    }
  }
  long long sum = 0;
  for (int k = 0; k < 62; k++) {
    sum += (1LL << k) % MOD * (long long)(xd[k] * (n - xd[k])) % MOD;
    sum %= MOD;
  }
  printf("%d\n", (int)sum);
  return 0;
}
