#include <bits/stdc++.h>
int N;
int mod = std::pow(10, 9) + 7;
int zero_bit[60];
int one_bit[60];
int main() {
  std::cin >> N;
  std::vector<long long> A(N + 1);
  for (int i = 1; i <= N; i++) {
    std::cin >> A[i];
    for (int bit = 0; bit < 60; bit++) {
      if ((A[i] >> bit) & 1) {
        one_bit[bit]++;
      } else {
        zero_bit[bit]++;
      }
    }
  }
  long long result = 0;
  for (int bit = 0; bit < 60; bit++) {
    result += (((1 << bit) % mod) * one_bit[bit] * zero_bit[bit]) % mod;
  }
  result = result % mod;
  std::cout << result << std::endl;
  return 0;
}
