#include <bits/stdc++.h>
const unsigned long long int MOD = 1000000007;
unsigned long long int A[300000];
int main() {
  int N;
  unsigned long long int res = 0, d = 1, c;
  scanf("%d ", &N);
  for (int i = 0; i < N; ++i) scanf("%lld", A + i);
  for (int j = 0; j < 60; ++j) {
    c = 0;
    for (int i = 0; i < N; ++i) {
      if (A[i] & 1) c++;
      A[i] >>= 1;
    }
    res += (c * (N - c) * d) % MOD;
    d *= 2;
    d %= MOD;
  }
  printf("%lld\n", res % MOD);
  return 0;
}
