#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ll n;
  cin >> n;
  ll a[n];
  ll cntz[61] = {};
  ll cnto[61] = {};
  for (ll i = 0; i < n; ++i) {
    cin >> a[i];
    ll value = 1;
    for (ll j = 0; j < 61; ++j) {
      if (a[i] & value)
        cnto[j]++;
      else
        cntz[j]++;
      value *= 2;
    }
  }
  ll ans = 0;
  for (ll i = 0; i < n; ++i) {
    ll value = 1;
    for (ll j = 0; j < 61; ++j) {
      ll add = value % 1000000007;
      if (a[i] & value)
        ans = (ans + (add * cntz[j]) % 1000000007) % 1000000007;
      else
        ans = (ans + (add * cnto[j]) % 1000000007) % 1000000007;
      value *= 2;
    }
  }
  cout << ans / 2 << endl;
}
