#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1e9 + 7;
int main() {
  int N;
  cin >> N;
  vector<ll> A(N);
  for (ll((i)) = (0); ((i)) < ((N)); ((i))++) cin >> A[i];
  ll res = 0;
  for (ll((idx)) = (0); ((idx)) < ((60)); ((idx))++) {
    ll cnt0 = 0, cnt1 = 0;
    for (auto a : A) ((a >> idx) & 1 ? cnt1 : cnt0)++;
    (res += ((1ll << idx) % MOD) * cnt0 * cnt1 % MOD) %= MOD;
  }
  cout << res << endl;
  return 0;
}
