#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
ll tmp1, tmp2, tmp3;
const ll mod = 1000000007;
const int INF = 1e9;
const ll INFLONG = 1e18;
void swap(ll *x, ll *y) {
  ll tmp;
  tmp = *x;
  *x = *y;
  *y = tmp;
}
int main() {
  ll n;
  cin >> n;
  vector<ll> vec(n);
  vector<ll> keta(60, 0);
  for (int i = 0; i < n; i++) {
    cin >> vec[i];
  }
  ll ans = 0;
  for (int i = 0; i < n; i++) {
    tmp1 = vec[i];
    ll cou = 0;
    while (tmp1 != 0) {
      if (tmp1 & 1) {
        keta[cou]++;
      }
      cou++;
      tmp1 = tmp1 >> 1;
    }
  }
  ll piv = 0;
  for (int i = 0; i < 60; i++) {
    tmp1 = keta[i];
    tmp2 = tmp1 * (n - tmp1);
    tmp3 = (ll)1 << piv;
    tmp3 %= mod;
    ans += (tmp3 * tmp2 % mod);
    ans %= mod;
    piv++;
  }
  cout << ans << endl;
}
