#include <bits/stdc++.h>
template <class T>
inline T chmax(T& a, const T b) {
  return a = (a < b) ? b : a;
}
template <class T>
inline T chmin(T& a, const T b) {
  return a = (a > b) ? b : a;
}
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const ll MOD = 1000000007;
const ll INF = 1e18;
using namespace std;
ll calc(ll a, ll b) {
  if (b == 0) return 1;
  if (b % 2 == 0) {
    ll d = calc(a, b / 2);
    return (d * d) % MOD;
  }
  return (a * calc(a, b - 1)) % MOD;
}
ll comb(ll n, ll r) {
  ll tmp = 1, ttmp = 1;
  for (ll i = n; i >= n - r + 1; i--) tmp = (tmp * i) % MOD;
  for (ll i = 1; i <= r; i++) ttmp = (ttmp * i) % MOD;
  return (tmp * calc(ttmp, MOD - 2)) % MOD;
}
signed main() {
  ll N;
  cin >> N;
  vector<ll> A(N);
  for (ll i = 0; i < ll(N); ++i) cin >> A[i];
  vector<ll> vec(100);
  for (ll i = 0; i < ll(N); ++i) {
    vector<ll> cnt;
    while (A[i] > 0) {
      cnt.push_back(A[i] & 1);
      A[i] /= 2;
    }
    for (ll i = 0; i < ll(cnt.size()); ++i) {
      vec[i] += cnt[i];
    }
  }
  ll ans = 0;
  for (ll i = 0; i < ll(100); ++i) {
    if (vec[i]) {
      if (vec[i] == N || vec[i] == 0) break;
      ans += (N - vec[i]) * vec[i] * pow(2, i);
    }
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}
