#include <bits/stdc++.h>
using namespace std;
uint64_t MOD = 1000000007;
int main() {
  int N;
  cin >> N;
  vector<int64_t> A(N);
  for (int64_t n = 0; n < N; n++) cin >> A.at(n);
  int64_t ans = 0, t = 1;
  for (int64_t i = 0; i < 60; i++) {
    int one = 0, zero = 0;
    for (auto a : A) {
      if (a & ((int64_t)1 << i))
        one++;
      else
        zero++;
    }
    int64_t _ans = (one * zero) % MOD * t % MOD;
    ans = (ans + _ans) % MOD;
    t = (t * 2) % MOD;
  }
  cout << ans << endl;
}
