#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ll n;
  cin >> n;
  vector<ll> a(n);
  for (ll i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<vector<ll>> c(63, vector<ll>(2));
  ll ans = 0;
  for (ll i = 0; i < n; i++) {
    for (ll j = 0; j < 63; j++) {
      int f = (a[i] >> j) & 1;
      ans += c[j][f ^ 1] * (1LL << j);
      c[j][f]++;
      ans %= 1000000007;
    }
  }
  cout << ans << endl;
}
