#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ll n;
  cin >> n;
  ll cnt[30] = {};
  for (ll i = 0; i < n; ++i) {
    ll a;
    cin >> a;
    a %= 1000000007;
    for (ll j = 0; j < 30; ++j)
      if (a & (1 << j)) {
        cnt[j]++;
      }
  }
  ll ans = 0;
  for (ll i = 0; i < 30; ++i) {
    if (cnt[i] == 0) continue;
    ll sum = 0;
    ll base = (1 << i) % 1000000007;
    sum = ((n - cnt[i]) * cnt[i]) % 1000000007;
    ans = (ans + (base * sum) % 1000000007) % 1000000007;
  }
  cout << ans << endl;
}
