#include <bits/stdc++.h>

using namespace std;
using ll = long long;
#define MOD 1000000007

int main() {
  int N;
  cin >> N;
  vector<ll> A(N);
  for (auto& a : A) cin >> a;
  ll ans = 0;
  for (int k = 0; k < 63; k++) {
    ll m = 1ll << k, c = 0;
    for (auto a : A)
      if (a >> k & 1) c++;
    ans += m % MOD * c % MOD * (N - c) % MOD;
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}
