#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int64_t a[N];
  int64_t sum = 0;
  int i;
  int j;
  for (i = 0; i < N; ++i) {
    cin >> a[i];
  }
  for (i = 0; i < 60; ++i) {
    int count = 0;
    for (j = 0; j < N; ++j) {
      count += a[i] % (int64_t)pow(2, i);
      sum = (sum + count * (N - count) * ((int64_t)pow(2, i) % 1000000007)) %
            1000000007;
    }
  }
  cout << sum << endl;
  return 0;
}
