#include <bits/stdc++.h>
using namespace std;
int main() {
  int a;
  double b, result;
  cin >> a;
  vector<double> vect;
  for (int i = 0; i < a; i++) {
    cin >> b;
    vect.push_back(b);
  }
  for (int i = 0; i < a - 1; i++) {
    for (int m = i + 1; m < a; m++) {
      long int c, d;
      c = vect[i];
      d = vect[m];
      result = result + (c ^ d);
    }
  }
  result = fmod(result, (10 * 10 * 10 * 10 * 10 * 10 * 10 * 10 * 10 + 7));
  std::cout << std::fixed << std::setprecision(0) << result;
  return 0;
}
