#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Vec = vector<ll>;
using VecP = vector<P>;
template <typename T>
bool chmax(T& a, const T& b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmix(T& a, const T& b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
const ll INF = 1e9 + 1;
const ll LINF = 1e18 + 1;
const ll MOD = 1e9 + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
ll PowMod(ll a, ll n) {
  if (n == 1) return a;
  if (!(n % 2)) return PowMod(a * a % MOD, n / 2);
  return a * PowMod(a * a % MOD, n / 2) % MOD;
}
ll inv(ll n, ll mod) { return PowMod(n, mod - 2); }
int main(void) {
  ll n;
  cin >> n;
  Vec a(n);
  for (ll(i) = (0); (i) < (n); ++(i)) cin >> a[i];
  Vec bit(60);
  for (ll(i) = (0); (i) < (n); ++(i)) {
    ll b = a[i];
    for (ll(j) = (0); (j) < (60); ++(j)) {
      if (b % 2) bit[j]++;
      b /= 2;
      if (!b) break;
    }
  }
  ll ans = 0;
  for (ll(i) = (0); (i) < (n); ++(i)) {
    ll b = a[i];
    for (ll(j) = (0); (j) < (60); ++(j)) {
      if (b % 2)
        ans += (n - bit[j]) * (1 << j);
      else
        ans += bit[j] * (1 << j);
      ans %= MOD;
      b /= 2;
    }
  }
  cout << ((ans * inv(2, MOD)) % MOD) << endl;
  return 0;
}
