#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = ll(1e12);
const ll mod = ll(1e9 + 7);
const double pi = acos(-1);
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
ll gcd(ll a, ll b) {
  if (a < b) swap(a, b);
  if (b == 0) return a;
  return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
  ll g = gcd(a, b);
  return a / g * b;
}
ll factorial(ll n) {
  ll ans = 1;
  for (ll(i) = 1; (i) <= (n); ++(i)) {
    ans *= i;
    ans %= mod;
  }
  return ans;
}
ll power(ll a, ll b) {
  ll ans = 1;
  a %= mod;
  while (b) {
    if (b & 1LL) ans = ans * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return ans;
}
vector<ll> FactorialInv, Factorial;
void init_combination(ll MAX) {
  Factorial.resize(MAX + 1);
  FactorialInv.resize(MAX + 1);
  Factorial[0] = 1;
  for (int i = 1; i <= MAX; i++) {
    Factorial[i] = Factorial[i - 1] * i % mod;
  }
  FactorialInv[MAX] = power(Factorial[MAX], mod - 2);
  for (ll i = MAX - 1; i >= 0; i--) {
    FactorialInv[i] = FactorialInv[i + 1] * (i + 1) % mod;
  }
}
ll combination(ll a, ll b) {
  if ((a == b) || (b == 0)) {
    return 1;
  }
  if (a < b) return 0;
  if (b < 0) return 0;
  ll ans = Factorial[a] * FactorialInv[b] % mod;
  ans = ans * FactorialInv[a - b] % mod;
  return ans;
}
int main() {
  ll n;
  cin >> n;
  vector<pair<ll, ll>> c(70, make_pair(0ll, 0ll));
  for (ll(i) = 0; (i) < (n); ++(i)) {
    ll a;
    cin >> a;
    ll cnt = 0;
    for (ll(j) = 0; (j) < (70); ++(j)) {
      if (a & 1ll)
        ++c[cnt].first;
      else
        ++c[cnt].second;
      ++cnt;
      a >>= 1;
    }
  }
  ll t = 1, ans = 0;
  for (ll(i) = 0; (i) < (70); ++(i)) {
    ans += t * c[i].first * c[i].second % mod;
    t *= 2;
    ans %= mod;
    t %= mod;
  }
  cout << (ans) << endl;
  return 0;
}
