#include <bits/stdc++.h>
using namespace std;
long long XORSUM(vector<long long>& V, long long n) {
  long long s, i, j, m;
  s = i = 0;
  while (i < 40) {
    m = 0;
    for (j = 0; j != n; j++) {
      if (V[j] & 1) m++;
      V[j] = V[j] >> 1;
    }
    s = (s + (((m * (n - m)) % (long long)(1e9 + 7)) *
              ((((long long)1) << i) % (long long)(1e9 + 7))) %
                 (long long)(1e9 + 7)) %
        (long long)(1e9 + 7);
    i++;
  }
  return s;
}
int main() {
  long long n;
  cin >> n;
  long long i;
  vector<long long> V;
  for (i = 0; i != n; i++) {
    long long x;
    cin >> x;
    V.push_back(x);
  }
  cout << XORSUM(V, n);
  return 0;
}
