#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
constexpr int MOD = 1000000007;
int64_t power(int64_t x, int64_t n, int64_t mod) {
  int64_t ret = 1;
  while (n > 0) {
    if (n & 1) (ret *= x) %= mod;
    (x *= x) %= mod;
    n >>= 1;
  }
  return ret;
}
int main() {
  int N;
  cin >> N;
  vector<lint> A(N);
  lint ans = 0;
  for (int i = (0), i_end_ = (N); i < i_end_; i++) cin >> A[i];
  for (int k = (0), k_end_ = (60); k < k_end_; k++) {
    lint zero = 0;
    lint one = 0;
    for (int i = (0), i_end_ = (N); i < i_end_; i++) {
      if ((A[i] >> k) & 1 == 1) {
        one++;
      } else {
        zero++;
      }
    }
    ans = (ans + power(2, k, MOD) * zero * one) % MOD;
  }
  cout << ans << endl;
}
