#include <bits/stdc++.h>
using namespace std;
int main() {
  int64_t N, A, sum = 0, bit = 1;
  cin >> N;
  vector<int64_t> array(60);
  for (int i = 0; i < 60; i++) {
    array[i] = 0;
  }
  for (int i = 0; i < N; i++) {
    cin >> A;
    int place = 0;
    while (A != 0) {
      if (A % 2 == 1) array[place]++;
      place++;
      A = A >> 1;
    }
  }
  for (int i = 0; i < 60; i++) {
    sum += array[i] * (N - array[i]) * bit;
    sum %= 1000000007;
    bit = bit << 1;
  }
  cout << sum << endl;
}
