#include <bits/stdc++.h>
using namespace std;
int main() {
  int64_t r = 0;
  int n;
  cin >> n;
  vector<string> v(n);
  vector<int> d(n);
  for (int i = 0; i < n; ++i) {
    int64_t a, c = 0;
    string b = "";
    cin >> a;
    while (a > 0) {
      if (a % 2 == 0)
        b += '0';
      else
        b += '1';
      a /= 2;
      ++c;
    }
    v.at(i) = b;
    d.at(i) = c;
  }
  sort(d.begin(), d.end());
  int k = d.at(n - 1);
  vector<int> c1(k, 0);
  for (int i = 0; i < k; ++i) {
    for (int j = 0; j < n; ++j) {
      if (v.at(j).size() > i && v.at(j).at(i) == '1') ++c1.at(i);
    }
  }
  for (int i = 0; i < k; ++i) {
    int64_t ri = min(c1.at(i), n - c1.at(i));
    for (int j = 0; j < i; ++j) {
      ri *= 2;
      ri %= 1000000007;
    }
    r += ri;
    r %= 1000000007;
  }
  cout << r << endl;
}
