#include <bits/stdc++.h>
int main() {
  using namespace std;
  constexpr unsigned long MOD = 1000000007;
  unsigned long N;
  cin >> N;
  vector<unsigned long> cnt(60);
  for (unsigned long _ = 0, A; _ < N; ++_) {
    cin >> A;
    for (unsigned long i = 0; i < 60; ++i)
      if (1 & (A >> i)) cnt[i]++;
  }
  unsigned long ans{0}, r{1};
  for (unsigned long i = 0; i < 60; ++i) {
    (ans += (cnt[i] * (N - cnt[i])) * r) %= MOD;
    (r *= 2) %= MOD;
  }
  cout << ans << endl;
  return 0;
}
