#include <bits/stdc++.h>
int main() {
  int n, inf = 1000000007, oc[63] = {}, b;
  long long a, ans = 0;
  std::cin >> n;
  for (int i = 0; i < n; ++i) {
    std::cin >> a;
    b = 0;
    while (true) {
      (a >> b & 1 ? ++oc[b] : 0);
      if (a >> b == 0) break;
      ++b;
    }
  }
  for (int i = 0; i < 63; ++i)
    if (oc[i] > 0) ans += (1 << i) % inf * oc[i] * (n - oc[i]) % inf;
  std::cout << ans % inf << "\n";
}
