#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll, ll>;
ll modpow(ll a, ll n, ll m) {
  if (n == 0) return 1;
  ll t = modpow(a, n >> 1, m);
  t = t * t % m;
  if (n & 1) t = t * a % m;
  return t;
}
ll modinv(ll a, ll m) { return modpow(a, m - 2, m); }
int main() {
  ll N;
  cin >> N;
  vec A(N);
  for (ll(i) = (0), (i_len) = (N); (i) < (i_len); ++(i)) cin >> A[i];
  vec C(60, 0);
  for (ll(i) = (0), (i_len) = (N); (i) < (i_len); ++(i)) {
    for (ll(j) = (0), (i_len) = (60); (j) < (i_len); ++(j))
      C[j] += ((A[i] >> j) & 1);
  }
  ll sum = 0;
  for (ll(i) = (0), (i_len) = (N); (i) < (i_len); ++(i)) {
    for (ll(j) = (0), (i_len) = (60); (j) < (i_len); ++(j)) {
      if ((A[i] >> j) & 1)
        sum = (sum + (1LL << j) * (N - C[j])) % 1000000007;
      else
        sum = (sum + (1LL << j) * C[j]) % 1000000007;
    }
  }
  cout << ((sum * modinv(2, 1000000007)) % 1000000007) << endl;
  return 0;
}
