#include <bits/stdc++.h>
int main() {
  int N;
  std::cin >> N;
  std::vector<int> bit(64);
  for (int i = 0; i < N; ++i) {
    int64_t A;
    std::cin >> A;
    for (int b = 0; b < 64; ++b) {
      int64_t mask = 1LL << b;
      if (A & mask) {
        bit[b] += 1;
      }
    }
  }
  int64_t const DIV = 1000000007LL;
  int64_t sum = 0LL;
  for (int b = 0; b < 64; b += 1) {
    int x = bit[b] * (N - bit[b]);
    int64_t v = 1LL << b;
    v %= DIV;
    int64_t y = x * v;
    y %= DIV;
    sum += y;
    sum %= DIV;
  }
  std::cout << sum << std::endl;
  return 0;
}
