#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  vector<ll> v(n);
  for (int i = 0; i < (int)(n); i++) cin >> v[i];
  vector<ll> cnt(61);
  for (int i = 0; i < (int)(n); i++) {
    for (int j = 0; j < 61; j++) {
      if ((v[i] >> j) & 1) cnt[j]++;
    }
  }
  ll ans = 0;
  ll m = n;
  for (int i = 0; i < (int)(n - 1); i++) {
    m--;
    for (int j = 0; j < 61; j++) {
      if ((v[i] >> j) & 1) cnt[j]--;
    }
    ll base = 1;
    for (int j = 0; j < 61; j++) {
      if ((v[i] >> j) & 1) {
        ans += base * (m - cnt[j]);
        ans %= MOD;
      } else {
        ans += base * cnt[j];
        ans %= MOD;
      }
      base *= 2;
    }
  }
  cout << ans % MOD << endl;
}
