#include <bits/stdc++.h>
using namespace std;
int main() {
  int64_t N;
  cin >> N;
  vector<int64_t> v(N);
  int64_t S = 0;
  int64_t j = 1;
  int64_t mod = 1000000007LL;
  for (int i = 0; i < N; i++) {
    cin >> v.at(i);
  }
  vector<int64_t> Z(N);
  for (int i = 0; i < N; i++) {
    Z.at(i) = 0LL;
  }
  while (v != Z) {
    int64_t m = 0;
    int64_t n = 0;
    for (int i = 0; i < N; i++) {
      if (v.at(i) % 2LL == 1) {
        m += 1;
      } else {
        n += 1;
      }
      v.at(i) /= 2LL;
    }
    S += (m * n) * j;
    j *= 2LL;
    S %= mod;
  }
  cout << S << endl;
}
