#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;
  cin >> n;
  vector<ll> a(n);
  for (int(i) = 0; (i) < (n); (i)++) cin >> a[i];
  vector<ll> one(60, 0);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 60; j++) {
      if ((a[i] >> j) & 1) one[j]++;
    }
  }
  ll ans = 0;
  for (int j = 0; j < 60; j++) {
    ll o = one[j];
    ans = (ans + o * (n - o) % MOD * (1LL << j) % MOD) % MOD;
  }
  cout << ans << endl;
  return 0;
}
