#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const int INF = 1e9;
const lint LINF = 1e18;
const lint MOD = 1e9 + 7;
const double EPS = 1e-10;
int main() {
  lint N;
  cin >> N;
  vector<lint> A(N, 0);
  for (int i = (int)(0); i < (int)(N); i++) cin >> A[i];
  lint ans = 0;
  lint f = 1;
  for (int d = 0; d <= 60; d++) {
    lint cnt0 = 0, cnt1 = 0;
    for (int i = 0; i < N; i++) {
      if (A[i] & (1ll << d))
        cnt1++;
      else
        cnt0++;
    }
    lint add = (((cnt0 * cnt1) % MOD) * f) % MOD;
    ans = (ans + add) % MOD;
    f *= 2;
  }
  cout << ans << endl;
  return 0;
}
