#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T>
using V = vector<T>;
template <class T>
using VV = V<V<T>>;
int main() {
  const ll MOD = (ll)1e9 + 7;
  int N;
  cin >> N;
  V<ll> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  V<ll> cnt1(60, 0);
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 60; j++) {
      if ((A[i] >> j) % 2 == 1) {
        cnt1[j]++;
      }
    }
  }
  ll ans = 0LL;
  for (int i = 0; i < 60; i++) {
    ll add = (N - cnt1[i]) * cnt1[i] % MOD;
    add = add * (1LL << i) % MOD;
    ans += add;
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}
