#include <bits/stdc++.h>
using namespace std;
int MOD = 1000000007;
int main() {
  int N;
  cin >> N;
  vector<uint32_t> A(60, 0);
  for (int n = 0; n < N; ++n) {
    uint64_t a;
    cin >> a;
    for (int idx = 0; a; ++idx, a /= 2) {
      if (a & 1) ++A[idx];
    }
  }
  uint64_t sum = 0;
  for (int idx = 0; idx < 60; ++idx) {
    sum +=
        ((uint64_t(A[idx]) * (N - A[idx])) % MOD * (uint64_t(1) << idx) % MOD) %
        MOD;
    sum %= MOD;
  }
  cout << sum << endl;
  return 0;
}
