#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  queue<long long> q;
  long long tmp1, tmp2;
  cin >> tmp1;
  long long ans = 0;
  for (long long i = 1; i < n; i++) {
    cin >> tmp2;
    tmp2 = (tmp1 ^ tmp2);
    ans += tmp2 % 1000000007;
    q.push(tmp2);
  }
  long long Xor;
  long long tmp;
  int j = 0;
  while (true) {
    tmp = q.front();
    q.pop();
    for (int i = 0; i < n - 2 - j; i++) {
      long long now = q.front();
      q.pop();
      Xor = (tmp ^ now);
      ans += Xor % 1000000007;
      q.push(Xor);
    }
    if ((n - 2 - j) == 0)
      break;
    else
      j++;
  }
  cout << ans % 1000000007 << endl;
}
