#include <bits/stdc++.h>
using namespace std;
using ll = unsigned long long;
const int MOD = 1e9 + 7;
int main() {
  ll N;
  vector<ll> A;
  cin >> N;
  for (int i = 0; i < (N); i++) {
    ll a;
    cin >> a;
    A.push_back(a);
  }
  ll ans;
  for (int i = 0; i < (63); i++) {
    ll zc, oc;
    zc = oc = 0;
    for (int j = 0; j < (N); j++) {
      if (A[j] % 2 == 0) {
        zc++;
      } else {
        oc++;
      }
      A[j] /= 2;
    }
    ans = (ans + ((zc * oc) % MOD << i) % MOD) % MOD;
  }
  cout << ans << endl;
  return 0;
}
