#include <bits/stdc++.h>
using namespace std;
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
struct greateri {
  template <class T>
  bool operator()(T const &a, T const &b) const {
    return a > b;
  }
};
using namespace std;
vector<long long> arr;
long long sumXOR(long long n) {
  long long sum = 0;
  for (long long i = 0; i < 64; i++) {
    long long zc = 0, oc = 0;
    long long idsum = 0;
    for (long long j = 0; j < n; j++) {
      if (arr[j] % 2 == 0)
        zc++;
      else
        oc++;
      arr[j] /= 2;
    }
    long long dol = pow(2, i);
    idsum = ((oc * zc) * dol);
    sum = (sum % 1000000007 + idsum % 1000000007) % 1000000007;
  }
  return sum % 1000000007;
}
int main() {
  long long n;
  cin >> n;
  for (long long i = 0; i < n; ++i) {
    long long yo;
    cin >> yo;
    arr.push_back(yo);
  }
  cout << sumXOR(n);
  return 0;
}
