#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long x, gu = 0;
  cin >> x;
  n--;
  long long a[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    gu += (x ^ a[i]);
    gu %= 1000000007;
    if (i >= 1) {
      gu += a[i - 1] ^ a[i];
      gu %= 1000000007;
    }
  }
  for (int i = 0; i < n - 1; i++) {
    long long mut = a[i];
    for (int j = i + 2; j < n; j++) {
      gu += (mut ^ a[j]);
      gu %= 1000000007;
    }
  }
  cout << gu << "\n";
  return 0;
}
