#include <bits/stdc++.h>
using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;
template <typename T>
constexpr T inf =
    static_cast<T>(pow(10, static_cast<int>(log10(numeric_limits<T>::max())))) +
    7;
constexpr llong mod = 1e9 + 7;
int main() {
  llong N;
  vector<llong> A;
  map<llong, llong> m;
  cin >> N;
  A.resize(N);
  for (auto &in : A) {
    cin >> in;
    for (int i = 0; i < 60; ++i) {
      m[i] += (in >> i) & 1;
    }
  }
  llong ans = 0;
  for (int i = 0; i < 60; ++i) {
    ans = (ans + ((N - m[i]) * m[i] % mod * (1ll << i))) % mod;
  }
  cout << ans << endl;
  return 0;
}
