#include <bits/stdc++.h>
constexpr int MOD = 1e9 + 7;
constexpr int M = 61;
int main() {
  int N;
  std::cin >> N;
  std::vector<int> zero(M), one(M);
  for (int i = 0; i < N; i++) {
    uint64_t a;
    std::cin >> a;
    for (int j = 0; j < M; j++) {
      if ((uint64_t)1 << j & a)
        ++one[j];
      else
        ++zero[j];
    }
  }
  int ans = 0;
  for (int i = M - 1; i >= 0; --i) {
    ans = (ans * 2 + one[i] * zero[i]) % MOD;
  }
  std::cout << ans << std::endl;
}
