#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
const int INF = 1 << 30;
int main() {
  int N;
  cin >> N;
  vector<ll> v(N);
  for (int i = 0; i < (int)(N); i++) {
    cin >> v[i];
  }
  ll ans = 0;
  ll pow = 1;
  for (int j = 0; j < 60; j++) {
    ll cnt = 0;
    for (int i = 0; i < N; i++) {
      if (v[i] & (1LL << j)) cnt++;
    }
    if (j > 0) pow = pow * 2 % MOD;
    ans += pow * cnt * (N - cnt);
    ans %= MOD;
  }
  cout << ans << endl;
}
