#include <bits/stdc++.h>
using namespace std;
const int64_t M = (int64_t)(1e9 + 7);
int64_t N;
int main() {
  cin >> N;
  vector<int64_t> A(N);
  for (auto &x : A) cin >> x;
  int64_t ans = 0;
  for (int i = 0; i < 62; ++i) {
    int64_t nums0 = 0, nums1 = 0;
    for (int j = 0; j < N; ++j) {
      if (A[j] % 2 == 0)
        ++nums0;
      else
        ++nums1;
      A[j] >>= 1LL;
    }
    ans += ((nums1 % M) * (nums0 % M) * ((1LL << i) % M)) % M;
  }
  cout << ans % M << "\n";
}
