#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int main() {
  unsigned long long N;
  cin >> N;
  vector<unsigned long long> one(61, 0);
  for (unsigned long long i = 0; i < N; i++) {
    unsigned long long a;
    cin >> a;
    for (unsigned long long j = 0; j <= 60; j++) {
      if (a & 1) one[j]++;
      a >>= 1;
    }
  }
  unsigned long long ans = 0, p = 1;
  for (unsigned long long i = 0; i <= 60; i++) {
    ans = (ans + ((p << i) % MOD * (one[i] * (N - one[i])) % MOD) % MOD) % MOD;
  }
  cout << ans << endl;
  return 0;
}
