#include <bits/stdc++.h>
int main(void) {
  int N = 0;
  scanf("%d", &N);
  long long A[N];
  long long sum;
  for (int h = 0; h < N; h++) {
    scanf("%lld", &A[h]);
  }
  for (int i = 0; i < N - 1; i = i + 2) {
    for (int j = 1 + i; j < N; j++) {
      sum = sum + (A[i] ^ A[j]);
      if ((j + 1) < N) {
        sum = sum + (A[i + 1] ^ A[j + 1]);
      }
    }
  }
  sum = sum % 1000000007;
  printf("%lld", sum);
  return 0;
}
