#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll mod = 1e9 + 7;
void Main() {
  ll n;
  cin >> n;
  vector<ll> A(n);
  for (ll i = 0; i < (n); ++i) cin >> A[i];
  ll ans = 0;
  for (ll k = 0; k < (65); ++k) {
    ll a = 0;
    for (ll i = 0; i < (n); ++i) {
      if (A[i] % 2) a++;
      A[i] >>= 1;
    }
    ll score = ((1LL << k) * a * (n - a)) % mod;
    (ans += score) %= mod;
  }
  cout << ans << endl;
}
int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}
