#include <bits/stdc++.h>
using ll = long long;
using namespace std;
constexpr ll MOD = 1e9 + 7;
ll n, a[300010];
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i];
  ll ans = 0;
  for (int i = 0; i < 60; ++i) {
    ll cnt = 0;
    for (int j = 0; j < n; ++j) {
      if (a[j] >> i & 1) ++cnt;
    }
    ans = (ans + (n - cnt) * cnt % MOD * (1LL << i) % MOD) % MOD;
  }
  cout << ans;
  return 0;
}
