#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T>
using V = vector<T>;
template <class T, class U>
using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;
ll pow2(ll m) {
  if (m == 0) return 1LL;
  ll tmp = pow2(m / 2);
  if (m & 1)
    return (tmp * tmp % MOD) * 2 % MOD;
  else
    return tmp * tmp % MOD;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;
  cin >> n;
  vll a(n);
  for (ll i = 0; i < (ll)n; ++i) cin >> a[i];
  vll dig(61, 0);
  for (ll i = 0; i < (ll)n; ++i) {
    for (ll j = 0; j < (ll)61; ++j) {
      if ((a[i] >> j) & 1) dig[j]++;
    }
  }
  vll aaa(61, 0);
  for (ll i = 0; i < (ll)n; ++i) {
    for (ll j = 0; j < (ll)61; ++j) {
      if ((a[i] >> j) & 1)
        aaa[j] += n - dig[j];
      else
        aaa[j] += dig[j];
    }
  }
  ll ans = 0;
  for (ll i = 0; i < (ll)61; ++i) {
    ans += pow2(i) * aaa[i] % MOD;
    if (ans >= MOD) ans -= MOD;
  }
  if (ans & 1) ans += MOD;
  ans /= 2;
  if (ans >= MOD) ans -= MOD;
  cout << ans << '\n';
  return 0;
}
