#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;
  cerr << "biggest"
       << ": " << biggest << '\n';
  cerr << "digit"
       << ": " << digit << '\n';
  for (ll d = (0); d <= (ll)(digit - 1); d++) {
    ll zeros = 0;
    ll ones = 0;
    for (ll i = 0; i < (N); ++i) {
      cerr << "As.at(i)"
           << ": " << As.at(i) << '\n';
      cerr << "d"
           << ": " << d << '\n';
      ll shift = 1;
      shift = (shift << d);
      ll flag = (As.at(i) & shift);
      cerr << "flag"
           << ": " << flag << '\n';
      cerr << "--\n";
      if (flag) {
        ones += 1;
      } else {
        zeros += 1;
      }
    }
    ll c = (zeros * ones) % MOD;
    for (ll i = 0; i < (d); ++i) {
      c = (c * 2) % MOD;
    }
    ans = (ans + c) % MOD;
  }
  cout << ans << endl;
}
