#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N;
  cin >> N;
  vector<long long> a(N);
  for (long long i = 0; i < N; i++) cin >> a[i];
  vector<long long> l(60, 0);
  for (long long i = 0; i < N; i++) {
    for (long long j = 0; j < 60; j++) {
      if (((a[i] >> j) & 1) == 1) {
        l[j]++;
      }
    }
  }
  long long ans = 0;
  long long power = 1;
  for (long long j = 0; j < 60; j++) {
    long long tmp;
    tmp = (l[j] * (N - l[j])) % (long long)(1e9 + 7);
    tmp = (tmp * power) % (long long)(1e9 + 7);
    ans = (ans + tmp) % (long long)(1e9 + 7);
    power *= 2;
  }
  cout << ans << endl;
  return 0;
}
