#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void solve() {
  int n;
  cin >> n;
  vector<ll> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  ll ans = 0;
  for (int i = 0; i < 60; ++i) {
    ll d0 = 0, d1 = 0;
    for (int j = 0; j < n; ++j) {
      if ((a[j] >> i) & 1)
        ++d1;
      else
        ++d0;
    }
    ll n = d0 * d1 % 1000000007;
    ll tmp = ((2LL << i) % 1000000007) * n % 1000000007;
    ans = (ans + tmp) % 1000000007;
  }
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  solve();
  return 0;
}
