#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using Graph = vector<vector<pii>>;
const int INF = 1e9 + 1;
const ll LLINF = 1e18;
const int MOD = 1e9 + 7;
int main() {
  int N;
  cin >> N;
  vector<int> cnt(60);
  for (int i = 0; i < N; ++i) {
    ll A;
    cin >> A;
    for (int j = 0; ((ll)1 << j) <= A; ++j)
      if (A & ((ll)1 << j)) cnt[j]++;
  }
  ll ans = 0, n = 1;
  for (int i = 0; i < 60; ++i) {
    ans += (ll)cnt[i] * (N - cnt[i]) * n;
    ans %= MOD;
    n <<= 1;
    n %= MOD;
  }
  cout << ans << endl;
  return 0;
}
