#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
constexpr ll MOD = 1000000007;
int main() {
  int n;
  cin >> n;
  ll a;
  vector<ll> one(60);
  for (int i = 0; i < (int)n; ++i) {
    cin >> a;
    for (int j = 0; j < (int)60; ++j)
      if (a >> j & 1) one[j]++;
  }
  ll ans = 0;
  for (int i = 0; i < (int)60; ++i)
    ans = (ans + one[i] * (n - one[i]) % MOD * (1ll << i) % MOD) % MOD;
  cout << ans << endl;
  return 0;
}
