#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1e9 + 7;
constexpr ll INF = 1ll << 60;
int main(int argc, char **argv) {
  ll N;
  cin >> N;
  vector<ll> A(N);
  for (ll i = (0); i < (N); ++i) cin >> A[i];
  ll fac{1};
  ll res{0};
  for (ll b = (0); b < (60); ++b) {
    ll o{0}, e{0};
    for (ll i = (0); i < (N); ++i) {
      if (A[i] & (1ll << b))
        ++o;
      else
        ++e;
    }
    (res += fac * o * e) %= MOD;
    (fac *= 2) %= MOD;
  }
  std::cout << res << std::endl;
}
