#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<uint64_t> A;
  A.reserve(N);
  for (int n = 0; n < N; ++n) {
    uint64_t a;
    cin >> a;
    A.push_back(a);
  }
  uint64_t sum = 0;
  for (int i = 0; i < N - 1; ++i) {
    for (int j = i + 1; j < N; ++j) {
      uint64_t x = A[i] ^ A[j];
      sum += x;
      if (sum >= 1000000007) sum %= 1000000007;
    }
  }
  cout << sum << endl;
  return 0;
}
