#include <bits/stdc++.h>
using namespace std;
using pint = pair<long long, long long>;
int main() {
  long long m = 1e9 + 7;
  ;
  int n;
  cin >> n;
  long long a[300006];
  long long sum = 0;
  for (int i = 0; i < (int)(n); i++) cin >> a[i];
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      long long mem = a[i - 1];
      mem ^= a[j - 1];
      sum += mem % m;
      sum %= m;
    }
  }
  cout << sum << endl;
}
