#include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pil = pair<int, ll>;
using pll = pair<ll, ll>;
template <typename T>
using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T>
using que = queue<T>;
template <typename T>
using deq = deque<T>;
template <typename T>
T id(T b) {
  return b;
};
template <typename T>
void chmax(T &x, T y) {
  if (x < y) x = y;
}
template <typename T>
void chmin(T &x, T y) {
  if (x > y) x = y;
}
template <typename S, typename K>
bool contains(S s, K k) {
  return s.find(k) != s.end();
}
void fastio() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
}
constexpr ll TEN(int n) {
  if (n == 0)
    return 1LL;
  else
    return 10LL * TEN(n - 1);
}
template <long long mod>
long long mod_pow(long long a, long long b) {
  if (b == 0) return 1;
  long long ret = mod_pow<mod>(a, b / 2);
  ret = ret * ret % mod;
  if (b % 2 == 1) ret = a * ret % mod;
  return ret;
}
const int MAX_N = 300000;
const ll MOD = TEN(9) + 7;
int n;
ll a[MAX_N];
int main() {
  fastio();
  cin >> n;
  for (size_t i = 0; i < size_t(n); i++) cin >> a[i];
  ll ans = 0;
  ll prev = 0;
  for (int i = 0; i <= 61; i++) {
    ll f = 0;
    for (int j = 0; j < n; j++) {
      f += (a[j] >> i) & 1LL;
    }
    ll temp = f * (n - f);
    ll cur = temp + prev;
    if (cur & 1LL) {
      ans = (ans + mod_pow<MOD>(2LL, i)) % MOD;
    }
    prev = cur >> 1;
  }
  int i = 62;
  while (prev) {
    if (prev & 1) {
      ans = (ans + mod_pow<MOD>(2LL, i)) % MOD;
    }
    prev >>= 1;
  }
  cout << ans % MOD << endl;
  return 0;
}
