#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll solve() {
  ll N;
  cin >> N;
  vector<ll> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  const ll MOD = 1e9 + 7;
  auto Add = [&](ll& x, ll y) { x = (x + y % MOD) % MOD; };
  auto Mul = [&](ll& x, ll y) { x = (x * y % MOD) % MOD; };
  auto Pow = [&](ll x, ll n) -> ll {
    ll t = x % MOD, r = 1;
    while (n > 0) {
      if (n & 1) Mul(r, t);
      Mul(t, t);
      n >>= 1;
    }
    return r;
  };
  auto Inv = [&](ll a) -> ll { return Pow(a, MOD - 2); };
  ll M = 60;
  vector<ll> d(M);
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < M; j++) {
      if (A[i] & (1LL << j)) d[j]++;
    }
  }
  ll ans = 0;
  for (int j = 0; j < M; j++) {
    ll x = d[j] * (N - d[j]);
    ll p = Pow(2, j);
    Mul(x, p);
    Add(ans, x);
  }
  return ans;
}
int main() {
  auto ans = solve();
  cout << ans << "\n";
  return 0;
}
