#include <bits/stdc++.h>
using i64 = long long;
int main() {
  constexpr i64 mod = 1000000007;
  int n;
  std::cin >> n;
  std::vector<i64> a(n);
  std::vector<i64> b(61);
  for (auto &e : a) {
    std::cin >> e;
    for (i64 i = 0; i <= 60; i++)
      if (e & (1ll << i)) b[i]++;
  }
  i64 ret = 0;
  for (i64 i = 0; i <= 60; i++) {
    ret = (ret + (1ll << i) * b[i] % mod * (n - b[i]) % mod) % mod;
  }
  std::cout << ret << std::endl;
  return 0;
}
