#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
const ll MOD = 1000000007;
void solve(void) {
  int N;
  cin >> N;
  vector<ll> A(N);
  ll ans = 0;
  for (int i = 0; i < (N); i++) {
    cin >> A[i];
  }
  for (int j = 0; j < (60); j++) {
    ll n0 = 0;
    ll n1 = 0;
    for (int i = 0; i < (N); i++) {
      if ((A[i] >> j) & 1LL) {
        n1++;
      } else {
        n0++;
      }
    }
    ll tmp = (((n1 * n0) % MOD) << j) % MOD;
    ans += tmp;
    ans = ans % MOD;
  }
  cout << ans << endl;
  return;
}
int main(int argc, const char* argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
  return 0;
}
