#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll atcoder_mod = 1e9 + 7;
template <typename T = int>
T in() {
  T x;
  cin >> x;
  return (x);
}
template <typename T = int, typename C = vector<T>>
C vecin(int N) {
  C x(N);
  for (int i = 0; i < (N); ++i) {
    x[i] = in<T>();
  }
  return move(x);
}
void vout() { cout << endl; }
template <typename Head, typename... Tail>
void vout(Head&& h, Tail&&... t) {
  cout << ' ' << h;
  vout(forward<Tail>(t)...);
}
void out() { cout << endl; }
template <typename Head, typename... Tail>
void out(Head&& h, Tail&&... t) {
  cout << h;
  vout(forward<Tail>(t)...);
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int N = in();
  vector<ll> A = vecin<ll>(N);
  auto maxA = *max_element(A.begin(), A.end());
  int B = 0;
  while (maxA) {
    B++;
    maxA >>= 1LL;
  }
  ll ans = 0;
  vector<ll> zero(B, 0), one(B, 0);
  for (int n = 0; n < (N); ++n) {
    ll v = A[n];
    for (int index = 0; index < (B); ++index) {
      if (v & 1)
        one[index]++;
      else
        zero[index]++;
      v >>= 1LL;
    }
  }
  for (int i = 0; i < (B); ++i) {
    ans += (((zero[i] * one[i]) % atcoder_mod) * (1LL << (i))) % atcoder_mod;
    ans %= atcoder_mod;
  }
  out(ans);
  return 0;
}
