#include <bits/stdc++.h>
int main() {
  unsigned long long N, a, sum = 0, partialSum = 0;
  std::vector<unsigned long long> v;
  std::unordered_map<unsigned long long,
                     std::pair<unsigned int, unsigned long long>>
      m;
  std::cin >> N;
  for (int i = 0; i < N; i++) {
    std::cin >> a;
    v.emplace_back(a);
  }
  for (int i = N - 1; i >= 0; i--) {
    partialSum = 0;
    int j = 0;
    if (m.find(v[i]) != m.end()) {
      partialSum = m[v[i]].second;
      for (j = m[v[i]].first; j > i; j--) {
        partialSum += (v[i] ^ v[j]);
      }
    } else {
      for (j = N - 1; j > i; j--) {
        if (m.find(v[i]) != m.end()) {
          j = m[v[i]].first;
          partialSum = m[v[i]].second;
        }
        partialSum += (v[i] ^ v[j]);
      }
    }
    m[v[i]] = std::make_pair(j, partialSum);
    sum = (sum + partialSum) % (1000000007);
  }
  std::cout << sum << '\n';
  return 0;
}
