#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using TP = tuple<ll, ll, ll>;
void init_io() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(18);
}
signed main() {
  init_io();
  ll n, ans = 0;
  cin >> n;
  vector<ll> a(n);
  ll btc[62][2] = {};
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (ll i = 62; i >= 0; i--) {
    for (int j = 0; j < n; j++) {
      ll x = a[j] & (1ll << i);
      btc[i][(bool)x]++;
    }
    ans += ((btc[i][0] * btc[i][1]) % 1000000007 * (1ll << i)) % 1000000007;
    ans %= 1000000007;
  }
  cout << ans << endl;
}
