#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<uint64_t> nums(n);
  for (vector<uint64_t>::iterator it = nums.begin(); it != nums.end(); ++it) {
    cin >> *it;
  }
  uint64_t sum = 0;
  for (vector<uint64_t>::iterator it = nums.begin(); it != nums.end(); ++it) {
    for (vector<uint64_t>::iterator it_2 = it + 1; it_2 != nums.end(); ++it_2) {
      sum += *it ^ *it_2;
    }
  }
  cout << sum % 1000000007 << endl;
  return 0;
}
