#include <bits/stdc++.h>
using namespace std;
const long long int r = 1e9 + 7;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<long long int> a(n);
  for (auto &i : a) cin >> i;
  long long int sum = 0;
  vector<long long int> v(n - 1);
  for (int i = 1; i < n; ++i) {
    v[i - 1] = a[0] ^ a[i];
    sum += v[i - 1] % r;
    sum %= r;
  }
  for (int i = 1; i < n - 1; ++i) {
    long long int cur = v[0];
    v.erase(v.begin());
    for (int j = 0; j < v.size(); ++j) {
      v[j] = v[j] ^ cur;
      sum += v[j] % r;
      sum %= r;
    }
  }
  cout << sum << "\n";
  return 0;
}
