#include <bits/stdc++.h>
using namespace std;
long N, i, j, m = 1e9 + 7, r, c;
int main() {
  cin >> N;
  vector<long> A(N);
  for (auto& a : A) cin >> a;
  for (i = 0; i < 60; i++) {
    c = 0;
    for (auto& a : A) c += a & 1 << i;
    c = c * (N - c) % m;
    for (j = 0; j < i; j++) c = c * 2 % m;
    r += c;
  }
  cout << r % m << endl;
}
