#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  ll a[n];
  for (auto i = (0); i < (n); ++i) cin >> a[i];
  ll ans = 0, p = 1;
  for (auto i = (0LL); i < (61); ++i) {
    ll zc = 0, oc = 0, s = 0;
    for (auto j = (0LL); j < (n); ++j) {
      if (a[j] & 1LL)
        oc++;
      else
        zc++;
      a[j] >>= 1LL;
    }
    s = oc * zc * p;
    ans = (ans + s) % mod;
    p = (p << 1LL) % mod;
  }
  cout << ans;
}
