#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;
const double PI = acos(-1);
using namespace std;
struct INIT {
  INIT() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
  }
} INIT;
signed main() {
  ll N;
  cin >> N;
  vector<ll> v(62, 0);
  for (ll i = 0; i < ll(N); ++i) {
    ll A;
    cin >> A;
    for (ll j = 0; j < ll(62); ++j) {
      if (A % 2) v[j]++;
      A /= 2;
    }
  }
  ll ans = 0;
  ll a = 1;
  for (ll i = 0; i < ll(62); ++i) {
    (ans += a * v[i] * (N - v[i])) %= MOD;
    (a *= 2) %= MOD;
  }
  cout << ans << "\n";
  return 0;
}
