#include <bits/stdc++.h>
using namespace std;
const long long DIV = 10e8 + 7;
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  long long max_item = -1001001001;
  for (auto item : a) max_item = max(max_item, item);
  int k = 0;
  while (1) {
    if (pow(2, k) > max_item) break;
    k++;
  }
  vector<vector<int>> ct(k, vector<int>(2, 0));
  for (int t = 0; t < n; t++) {
    long long a_t = a[t];
    for (int i = k; i > 0; i--) {
      if (1 & a_t >> (i - 1)) {
        ct[i - 1][1]++;
      } else {
        ct[i - 1][0]++;
      }
    }
  }
  long long ans = 0;
  for (int t = k - 1; t >= 0; t--) {
    ans += ((long long)pow(2, t) * ct[t][0] * ct[t][1] % DIV);
  }
  ans %= DIV;
  cout << ans << endl;
  return 0;
}
