#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1 << 30;
const ll INFll = 1LL << 62;
const int mod = (1e9) + 7;
using P = pair<ll, ll>;
int main() {
  ll n;
  cin >> n;
  vector<ll> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  vector<ll> memo(70, 0);
  for (int i = 0; i < 60; ++i) {
    for (int j = 0; j < n; ++j) {
      if (a[j] & (1LL << i)) memo[i]++;
    }
  }
  ll ans = 0;
  for (int i = 0; i < 60; ++i) {
    ans += memo[i] * (n - memo[i]) * ((1LL << i) % mod);
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
