#include <bits/stdc++.h>
int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  int32_t N;
  std::cin >> N;
  std::vector<int64_t> A(N);
  for (auto& i : A) {
    std::cin >> i;
  }
  std::vector<int32_t> num_dig(60);
  for (int32_t i = 0; i < N; i++) {
    int64_t val = A[i];
    for (int32_t dig = 0; dig < 60; dig++) {
      if ((val & 1) == 1) {
        num_dig[dig]++;
      }
      val = (val >> 1);
    }
  }
  int64_t MOD = 1000000007;
  int64_t sum = 0;
  int64_t base = 1;
  for (int32_t i = 0; i < 60; i++) {
    int64_t cmb = num_dig[i] * (N - num_dig[i]);
    cmb %= MOD;
    int64_t base_mod = base % MOD;
    sum += base_mod * cmb;
    sum %= MOD;
    base = base << 1;
  }
  std::cout << sum << std::endl;
  return 0;
}
