#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int* a = new int[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  int i = 1, sum = 0;
  for (int j = i + 1; j <= n; j++) {
    if (i > n - 1) break;
    sum = sum + (a[i] ^ a[j]);
    i++;
  }
  cout << sum % 1000000007 << endl;
  return 0;
}
