#include <bits/stdc++.h>
using namespace std;
unsigned long long int hasil = 0;
unsigned long long int xor4(unsigned long long int t[], int n, int i, int f) {
  if (f == n - 2) {
    return hasil + (t[f] ^ t[i]);
  } else if (n - 1 == i) {
    return hasil + (t[f] ^ t[i]) + xor4(t, n, f + 2, f + 1);
  } else {
    return hasil + (t[f] ^ t[i]) + xor4(t, n, i + 1, f);
  }
}
int main(int argc, char const *argv[]) {
  int n, hitungan = 0;
  cin >> n;
  unsigned long long int tempat[n];
  for (int i = 0; i < n; i++) {
    scanf("%d", &tempat[i]);
  }
  cout << xor4(tempat, n, 1, 0) % (long long int)(pow(10, 9) + 7);
  return 0;
}
