#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N = pow(10, 9) + 7;
  vector<int> ans(61, 0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    long long a;
    cin >> a;
    int count = 0;
    while (a != 0) {
      ans.at(count) += a % 2;
      a /= 2;
      count++;
    }
  }
  long long out = 0;
  long long keta = 1;
  for (int i = 0; i < 61; i++) {
    out = (out + keta * (n - ans.at(i)) * ans.at(i)) % N;
    keta = (keta * 2) % N;
  }
  cout << out << endl;
}
