#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll mod = 1000000007;
const ll INF = 1LL << 60;
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
int main() {
  int n;
  cin >> n;
  vector<ll> d(60);
  for (int i = 0; i < n; i++) {
    ll a;
    cin >> a;
    for (int j = 0; j < 60; j++)
      if (a & (1LL << j)) d[j]++;
  }
  ll ans = 0;
  for (int i = 0; i < 60; i++) {
    ans = (ans + d[i] * (n - d[i]) * ((1ll << i) % mod)) % mod;
  }
  cout << ans << endl;
}
