#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int64_t A[N];
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  int64_t sum = 0;
  for (int d = 0; d < 60; d++) {
    int count0 = 0;
    int count1 = 0;
    for (int i = 0; i < N; i++) {
      if ((A[i] >> d) & 1LL) {
        count1++;
      } else {
        count0++;
      }
    }
    sum += (count0 * count1 * (int64_t)pow(2, d)) % (int)(pow(10, 9) + 7);
  }
  cout << sum % (int)(pow(10, 9) + 7) << endl;
  return 0;
}
