#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll MOD = (ll)1e9 + 7;
signed main() {
  ll N;
  cin >> N;
  ll ans = 0;
  ll biggest = 0;
  vector<ll> As(N);
  for (ll i = 0; i < (N); ++i) {
    cin >> As.at(i);
    if (As.at(i) > biggest) {
      biggest = As.at(i);
    }
  }
  ll digit = (ll)log2(biggest) + 1;
  for (ll d = (0); d <= (ll)(digit - 1); d++) {
    ll zeros = 0;
    ll ones = 0;
    for (ll i = 0; i < (N); ++i) {
      ll shift = (1LL << d);
      ll flag = (As.at(i) & shift);
      if (flag) {
        ones += 1;
      } else {
        zeros += 1;
      }
    }
    ll c = ((zeros * ones) << d) % MOD;
    ans = (ans + c) % MOD;
  }
  cout << ans << endl;
}
