#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll k_max = 62;
vector<P> cnt(k_max);
ll pow_mod(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res *= a;
    a = a * a;
    a %= mod;
    n >>= 1;
    res %= mod;
  }
  return res;
}
int main() {
  ll N;
  cin >> N;
  ll A[N];
  for (ll i = 0; i < N; i++) cin >> A[i];
  for (ll i = 0; i < k_max; i++) {
    cnt[i].first = 0;
    cnt[i].second = 0;
  }
  ll ans = 0;
  for (ll i = 0; i < N; i++) {
    ll x = A[i];
    for (ll k = 0; k < k_max; k++) {
      if (x & 1)
        cnt[k].first++;
      else
        cnt[k].second++;
      x >>= 1;
    }
  }
  for (ll k = 0; k < k_max; k++) {
    ll c = cnt[k].first * cnt[k].second;
    ans += (pow_mod(2, k, 1000000007) * c) % 1000000007;
    ans %= 1000000007;
  }
  cout << ans << endl;
}
