#include <bits/stdc++.h>

using namespace std;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  
  auto lshift = [](int n) {
    size_t t = 1;
    for (int i = 0; i < n; i++) {
      t <<= 1;
      t %= MOD;
    }
    return t;
  };

  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 * (lshift(i))) % MOD;
    ans %= MOD;
  }
  cout << ans << endl;

  return 0;
}
