#include <bits/stdc++.h>
using namespace std;
int main() {
  int64_t A;
  cin >> A;
  vector<int64_t> nums(A, 0);
  for (size_t i = 0; i < A; ++i) cin >> nums[i];
  int64_t sum = 0;
  for (size_t i = 0; i < A - 1; ++i) {
    for (size_t j = i + 1; j < A; ++j) {
      sum += nums[i] ^ nums[j];
      sum %= 1000000007;
    }
  }
  cout << sum << std::endl;
  return 0;
}
