#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
void Main() {
  ll N;
  cin >> N;
  vector<ll> A(N);
  for (ll i = 0; i < (ll)(N); i++) cin >> A[i];
  ll ans = 0;
  map<ll, ll> cnt;
  for (ll i = 0; i < (ll)(N); i++) {
    ll a = A[i];
    for (ll j = 0; j < (ll)(61); j++) {
      if ((a & (1LL << j))) {
        cnt[j]++;
      }
    }
  }
  for (ll j = 0; j < (ll)(61); j++) {
    ll tmp = 1LL << j;
    tmp %= MOD;
    ans += ((cnt[j] * (N - cnt[j])) * tmp) % MOD;
    ans %= MOD;
  }
  cout << ans % MOD << '\n';
}
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
  return 0;
}
