#include <bits/stdc++.h>
using namespace std;
using veci = vector<int>;
using pii = pair<int, int>;
using vecii = vector<pii>;
using ll = long long;
using vecl = vector<ll>;
ll const MOD = ll(1e9 + 7);
void solve() {
  int n;
  cin >> n;
  vector<int> cnt(60, 0);
  ll ai;
  for (int i = 0; i < n; ++i) {
    cin >> ai;
    for (int j = 0; j < 60; ++j) {
      if (ai & (1LL << j)) {
        cnt[j] += 1;
      }
    }
  }
  ll ans = 0;
  for (int j = 0; j < 60; ++j) {
    ll mulBase = (1LL << j) % MOD;
    ans += mulBase * cnt[j] * (n - cnt[j]);
    ans %= MOD;
  }
  cout << ans << '\n';
}
int main(int argc, char* argv[]) {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  solve();
}
