#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<uint64_t> nums(n);
  for (vector<uint64_t>::iterator it = nums.begin(); it != nums.end(); ++it) {
    cin >> *it;
  }
  uint64_t sum = 0;
  for (uint64_t i = 0; i < 60; ++i) {
    uint64_t mask = (uint64_t)1 << i;
    uint64_t c0 = 0;
    uint64_t c1 = 0;
    for (vector<uint64_t>::iterator it = nums.begin(); it != nums.end(); ++it) {
      if ((*it & mask) != 0)
        c1++;
      else
        c0++;
    }
    sum += c0 * c1 * mask;
  }
  cout << sum % ((uint64_t)1e9 + 7) << endl;
  return 0;
}
