#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long int* a;
  a = (long long int*)malloc(n * sizeof(long long int));
  for (int i = 0; i < n; i++) {
    scanf("%lld", &a[i]);
  }
  long long int sum = 0;
  for (int i = 0; i < n / 2; i++) {
    for (int j = i + 1; j < n; j++) {
      sum += a[i] ^ a[j];
      sum %= 1000000007;
      if (n - i - 2 < j && n - i - 2 != i) {
        sum += a[n - i - 2] ^ a[j];
        sum %= 1000000007;
      }
    }
  }
  cout << sum << endl;
}
