#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;
bool pairCompare(const pair<ll, double>& firstElof,
                 const pair<ll, double>& secondElof) {
  return firstElof.second < secondElof.second;
}
ll b[61] = {0};
signed main() {
  ll m = pow(10, 9) + 7;
  ll n;
  cin >> n;
  vector<ll> a(n + 1, -1);
  ll ans = 0;
  for (ll i = 0; i < n; i++) {
    cin >> a[i];
    for (ll j = 0; j < 61; j++) {
      if ((a[i] >> j) & 1LL != 0) {
        b[j]++;
      }
    }
  }
  for (ll i = 0; i < 61; i++) {
    ans += (b[i] * (n - b[i])) * (1LL << i);
    ans %= m;
  }
  cout << ans;
}
