#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
template <class T, class U>
bool cmax(T& a, U b) {
  if (a < b) {
    a = b;
    return true;
  } else
    return false;
}
template <class T, class U>
bool cmin(T& a, U b) {
  if (a > b) {
    a = b;
    return true;
  } else
    return false;
}
constexpr int MAX = 1e7;
constexpr ll MOD = 1e9 + 7;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (ll i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}
long long COM(ll n, ll k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;
  cin >> n;
  vl a(n);
  for (ll i = 0; i < n; i++) {
    cin >> a[i];
  }
  constexpr ll mod = 1e9 + 7;
  COMinit();
  ll ans = 0;
  for (ll i = 0; i < n; i++) {
    ans = (ans + (a[i] * (n - 1)) % MOD) % MOD;
  }
  vl cnt(64);
  for (ll i = 0; i < n; i++) {
    for (ll j = 0; j < 62; j++) {
      if (a[i] & (1LL << j)) {
        cnt[j]++;
      }
    }
  }
  cerr << ans << endl;
  ll tmp = 0;
  for (ll i = 0; i < 62; i++) {
    tmp += (COM(cnt[i], 2) * ((1LL << (i + 1)) % MOD)) % MOD;
    tmp %= MOD;
  }
  ans -= tmp;
  ans += MOD;
  ans += MOD;
  ans %= MOD;
  cout << ans << endl;
}
