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