#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  size_t N;
  cin >> N;
  vector<size_t> A(N);
  for (auto& a : A) cin >> a;
  size_t ans = 0;
  constexpr size_t MOD = 1e9 + 7;
  for (size_t i = 0; i < 60; i++) {
    size_t cnt1 = 0;
    for (auto a : A) {
      if (a & (1ul << i)) cnt1++;
    }
    size_t sum = cnt1 * (N - cnt1);
    ans += (sum * ((1ul << i) % MOD)) % MOD;
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}
