#include <bits/stdc++.h>
template <class T>
bool maxi(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool mini(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
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 i = 0; i < 61; i++) {
    ll su0 = 0;
    ll su1 = 0;
    for (ll j = 0; j < N; j++) {
      if ((A[j] >> i) & 1)
        ++su1;
      else
        ++su0;
    }
    ans += ((su1 * su0) % 1000000007) * (1LL << i);
    ans %= 1000000007;
  }
  cout << ans << "\n";
}
int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}
