#include <bits/stdc++.h>
const int BIT_LENGTH = 64;
uint64_t pow64(const uint64_t base, const uint64_t index) {
  uint64_t x = 1;
  for (uint64_t i = 0; i < index; ++i) {
    x *= base;
  }
  return x;
}
int main() {
  int n;
  std::cin >> n;
  auto a = std::vector<uint64_t>(n, 0);
  for (int i = 0; i < n; ++i) {
    std::cin >> a[i];
  }
  auto zeros = std::vector<int>(BIT_LENGTH, 0);
  auto ones = std::vector<int>(BIT_LENGTH, 0);
  for (int i = 0; i < n; ++i) {
    uint64_t mask = 1;
    for (int b = 0; b < BIT_LENGTH; ++b) {
      if (a[i] & mask) {
        ++ones[b];
      } else {
        ++zeros[b];
      }
      mask <<= 1;
    }
  }
  uint64_t result = 0;
  uint64_t pow2 = 1;
  const uint64_t mod = pow64(10, 9) + 7;
  for (int b = 0; b < BIT_LENGTH; ++b) {
    const uint64_t s = (ones[b] * zeros[b] * pow2) % mod;
    result = (result + s) % mod;
    pow2 *= 2;
  }
  std::cout << result;
  return 0;
}
