#include <bits/stdc++.h>
using namespace std;
using ll = unsigned long long;
const ll MOD = 1e9 + 7;
int cnt[60];
int main() {
  int N;
  cin >> N;
  ll a[N];
  for (int i = 0; i < N; i++) cin >> a[i];
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 60; j++) {
      if ((a[i] >> j) & 1) cnt[j]++;
    }
  }
  ll ans = 0;
  for (int i = 0; i < 40; i++) {
    if (cnt[i] == 0) continue;
    ll t = pow(2, i);
    ll tmp = (t % MOD) * cnt[i];
    ll tmp2 = N - cnt[i];
    ans += ((tmp % MOD) * tmp2) % MOD;
    ans %= MOD;
  }
  cout << ans % MOD << endl;
  return 0;
}
