#include <bits/stdc++.h>
using namespace std;
int main() {
  long N;
  cin >> N;
  vector<long> A(N, 0);
  for (long i = 0; i < N; i++) cin >> A.at(i);
  vector<long> B(61, 0);
  for (long i = 0; i < N; i++) {
    long AA = A.at(i);
    long j = 0;
    while (AA > 0) {
      if (1 == AA % 2) B.at(j)++;
      AA /= 2;
      j++;
    }
  }
  vector<long> C(61, 0);
  for (long i = 0; i < N; i++) {
    long AA = A.at(i);
    for (long j = 0; j < 61; j++) {
      if (1 == AA % 2) {
        C.at(j) += N - B.at(j);
      } else {
        C.at(j) += B.at(j);
      }
      AA /= 2;
    }
  }
  long S = 0;
  long D = 1;
  for (int i = 0; i < 61; i++) {
    long DD = D * C.at(i);
    DD %= 1000000007;
    S += DD;
    S %= 1000000007;
    D *= 2;
  }
  S *= 500000004;
  S %= 1000000007;
  cout << S << endl;
  return 0;
}
