#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
const ll INF = 1e18;
const double pi = acos(-1);
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const int dy8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
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;
}
void solve() {
  std::ifstream in("sample.txt");
  std::cin.rdbuf(in.rdbuf());
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<ll> A(n);
  for (int i = int(0); i < int(n); i++) cin >> A[i];
  ll ans = 0;
  for (int k = 0; k < 60; k++) {
    int oneNum = 0;
    for (int i = 0; i < n; i++) {
      if (A[i] >> k & 1) oneNum += 1;
    }
    ll now = oneNum * (n - oneNum) % MOD;
    for (int j = int(0); j < int(k); j++) now = now * 2 % MOD;
    ans += now;
    ans %= MOD;
  }
  cout << ans << endl;
}
signed main() {
  solve();
  return 0;
}
