#include <bits/stdc++.h>
constexpr int kMod = 1000000007;
int main() {
  int N;
  std::cin >> N;
  std::vector<long long> A(N);
  long long max_A = 0;
  for (int n = 0; n < N; ++n) {
    std::cin >> A[n];
    max_A = std::max(max_A, A[n]);
  }
  long long total = 0;
  for (long long i = 0; i <= (long long)log2(max_A); ++i) {
    long long zeros = 0, ones = 0;
    for (long long a : A) {
      if (a & (1LL << i))
        ++ones;
      else
        ++zeros;
    }
    total = total + ones * zeros * (1LL << i) % kMod;
    total %= kMod;
  }
  std::cout << total % kMod << std::endl;
}
