#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using VI = vector<int>;
using VD = vector<double>;
using VLL = vector<ll>;
using VS = vector<string>;
using VC = vector<char>;
using VB = vector<bool>;
const int MOD = 1000000007;
const int INF = 1000000000;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return true;
  }
  return false;
}
int main() {
  int n;
  cin >> n;
  VI cnt(60, 0);
  for (int i = (0), i_len = (n); i < i_len; ++i) {
    ll a;
    cin >> a;
    for (int j = (0), j_len = (60); j < j_len; ++j) {
      if (a & 1) ++cnt[j];
      a /= 2;
      if (!a) break;
    }
  }
  ll ans = 0;
  for (int i = (0), i_len = (60); i < i_len; ++i) {
    ll weight = (1LL << i) % MOD;
    (ans += (cnt[i] * (n - cnt[i])) % MOD * weight) %= MOD;
  }
  cout << ans << "\n";
  return 0;
}
