#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using vb = vector<bool>;
using mll = map<ll, ll>;
using sll = stack<ll>;
const ll INF = 1LL << 60;
const long long MOD = 1000000007;
ll mod_pow(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll res = mod_pow(x * x % mod, n / 2, mod);
  if (n & 1) res = res * x % mod;
  return res;
}
void solve(long long N, std::vector<long long> A) {
  ll ans = 0;
  for (ll j(0); (j) < (60); (j)++) {
    ll cnt = 0;
    for (ll i(0); (i) < (N); (i)++) {
      if ((A[i] >> j) & 1) cnt++;
    }
    ll tmp = cnt * (N - cnt);
    tmp = (tmp * mod_pow(2, j, MOD)) % MOD;
    ans = (ans + tmp) % MOD;
  }
  cout << ans << endl;
}
int main() {
  long long N;
  scanf("%lld", &N);
  std::vector<long long> A(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &A[i]);
  }
  solve(N, std::move(A));
  return 0;
}
