#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll MOD = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  for (int i = 0; i < (int)(n); i++) cin >> a[i];
  vector<int> cnt0(61);
  vector<int> cnt1(61);
  for (int i = 0; i < (int)(n); i++) {
    for (int bit = 0; bit < 61; ++bit) {
      if (a[i] & (1LL << bit))
        cnt1[bit]++;
      else
        cnt0[bit]++;
    }
  }
  ll ans = 0;
  ll c = 1;
  for (int i = 0; i < (int)(61); i++) {
    ll tmp = (cnt0[i] * cnt1[i] * c) % MOD;
    ans += tmp;
    ans %= MOD;
    c *= 2;
    c %= MOD;
  }
  cout << ans << endl;
}
