#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;
  for (int64_t i = 0; i < 60; i++) {
    int n = 0;
    for (auto a : A) {
      if (a & (1ll << i)) n++;
    }
    ans += (n * (N - n) % MOD) * ((int64_t)pow(2, i) % MOD);
    ans %= MOD;
  }
  cout << ans << endl;
}
