#include <bits/stdc++.h>
const int MOD = 1e9 + 7;
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<long int> a(n);
  for (auto& in : a) {
    cin >> in;
  }
  vector<int> d(60, 0);
  for (auto i = 0ll; i < 60; ++i) {
    for (const auto& x : a) {
      if ((x >> i) & 1) {
        d[i]++;
      }
    }
  }
  long long ans = 0;
  for (auto i = 0; i < 60; ++i) {
    ans += ((1ll << i) % MOD * d[i] * (n - d[i])) % MOD;
    ans %= MOD;
  }
  cout << ans;
}
