#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, sum = 0;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }
  sort(a.begin(), a.end());
  for (int x = 2; x <= a.at(a.size() - 1) * 2; x *= 2) {
    int zero = 0, one = 0;
    for (int i = 0; i < n; i++) {
      if ((a.at(i) % x) < (x / 2)) {
        zero++;
      } else {
        one++;
      }
    }
    sum += (zero * one * x / 2);
  }
  cout << sum % (1000000007) << endl;
}
