#include <iostream>
#include <string>
#include <vector>
using namespace std;
using namespace std::literals;

int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; ++i)
    cin >> a[i];

  constexpr unsigned long long m = 1'000'000'000 + 7;

  long long sum = 0;
  static unsigned long long cache[300'000];

  for (int i = 0; i < n - 1; ++i) {
    for (int j = i + 1; j < n; ++j) {
      cache[j - (i + 1)] = a[i] ^ a[j];
    }
    const auto k = n - (i + 1);
    const auto nblock = k / 16;
    for (int iblock = 0; iblock < nblock; ++iblock) {
      unsigned long long x = 0;
      for (int j = 0; j < 16; ++j)
        x += cache[j];
      x %= m;
      sum += x;
      if (sum >= m)
        sum -= m;
    }

    {
      unsigned long long x = 0;
      const auto kr = k - 16 * nblock;
      for (int j = 0; j < kr; ++j)
        x += cache[nblock * 16 + j];
      x %= m;
      sum += x;
      if (sum >= m)
        sum -= m;
    }
  }

  cout << sum;
  return 0;
}
