#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const long long Mod = 1e9 + 7;
int main() {
  ll t, n, x, i, j;
  cin >> n;
  vector<ll> v;
  while (n--) {
    cin >> x;
    v.push_back(x);
  }
  ll sum = 0;
  for (i = 0; i < 63; i++) {
    ll one = 0, zero = 0;
    ll q = (1LL << i);
    for (j = 0; j < v.size(); j++) {
      if (v[j] & q) one++;
    }
    sum += (((v.size() - one) % Mod) * (one % Mod) * (q % Mod)) % Mod;
  }
  cout << sum % Mod << endl;
  return 0;
}
