#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<long long> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  long long sum = 0;
  long long S = 0;
  for (long long i = N - 1; i > 0; i++) {
    sum = S + (A[i] ^ A[i - 1]) % 1000000007;
    S = sum;
  }
  cout << sum % 1000000007;
  return 0;
}
