#include <bits/stdc++.h>
using namespace std;
int main() {
  int64_t N;
  cin >> N;
  vector<int64_t> A(N);
  for (int64_t i = 0; i < N; i++) cin >> A.at(i);
  int64_t c = 0;
  int64_t ans = 0;
  for (int64_t i = 0; i < N - 1; i++) {
    for (int64_t j = i + 1; j < N; j++) {
      c = A.at(i) ^ A.at(j);
      ans += c;
      ans = ans % (1000000007);
    }
  }
  cout << ans << endl;
}
