#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
signed main() {
  int N;
  cin >> N;
  vector<ll> a(N);
  for (int i = 0; i < N; i++) cin >> a[i];
  ll ans = 0;
  for (int digit = 0; digit <= 60; digit++) {
    int c0 = 0, c1 = 0;
    for (int i = 0; i < N; i++) {
      if (1 & (a[i] >> digit))
        c1++;
      else
        c0++;
    }
    ll tmp = (1ll << digit) % MOD;
    int c = c0 * c1 % MOD;
    tmp = tmp * c % MOD;
    ans += tmp;
    ans %= MOD;
  }
  cout << ans << endl;
}
