#include <iostream>
#include <string>
#include <vector>
using namespace std;
using namespace std::literals;

int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; ++i)
    cin >> a[i];

  constexpr long long m = 1'000'000'000 + 7;

  long long sum = 0;
  for (int i = 0; i < n - 1; ++i) {
    for (int j = i + 1; j < n; ++j) {
      long long x = a[i] ^ a[j];
      sum = (sum + x) % m;
    }
  }

  cout << sum;
  return 0;
}
