#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int aaa[n];
  for (int x = 0; x < n; x++) {
    cin >> aaa[x];
  }
  int64_t sum = 0;
  for (int y = 0; y < n - 1; y++) {
    for (int z = y + 1; z < n; z++) {
      int q = aaa[y];
      int w = aaa[z];
      sum = sum + (q ^ w);
    }
  }
  if (sum >= (pow(10, 9) + 7)) {
    int64_t z = pow(10, 9) + 7;
    cout << sum % z << endl;
  } else {
    cout << sum << endl;
  }
  return 0;
}
