#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;
int main() {
  ll N;
  cin >> N;
  ll cnt[62] = {0};
  for (int i = (int)(0); i < (int)(N); ++i) {
    ll a;
    cin >> a;
    for (int j = (int)(0); j < (int)(60); ++j) {
      if ((a) & (1ll << j)) {
        cnt[j]++;
      }
    }
  }
  ll tmp;
  ll ans = 0;
  for (int i = (int)(0); i < (int)(60); ++i) {
    tmp = 1;
    for (int j = (int)(0); j < (int)(i); ++j) {
      tmp *= 2;
      tmp %= mod;
    }
    tmp *= cnt[i] * (N - cnt[i]);
    tmp %= mod;
    ans += tmp;
    ans %= mod;
  }
  cout << ans << endl;
}
