#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll MOD = 1000000007;
int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  for (int(i) = 0; (i) < (n); ++(i)) cin >> a[i];
  ll res = 0;
  for (int d = 0; d < 60; ++d) {
    ll n0 = 0, n1 = 0;
    for (int i = 0; i < n; ++i) {
      if ((a[i] >> d) & 1)
        ++n1;
      else
        ++n0;
    }
    ll tmp = (1ll << d) % MOD;
    ll n = n0 * n1 % MOD;
    tmp = tmp * n % MOD;
    res = (tmp + tmp) % MOD;
  }
  cout << res << endl;
}
