//#define NDEBUG
#include <cstddef>
#include <cstdint>
#include <vector>

namespace n91 {

using i8 = std::int_fast8_t;
using i32 = std::int_fast32_t;
using i64 = std::int_fast64_t;
using u8 = std::uint_fast8_t;
using u32 = std::uint_fast32_t;
using u64 = std::uint_fast64_t;
using isize = std::ptrdiff_t;
using usize = std::size_t;

class rep {
  const usize f, l;

public:
  class itr {
    friend rep;
    usize i;
    constexpr itr(const usize x) noexcept : i(x) {}

  public:
    void operator++() noexcept { ++i; }
    constexpr usize operator*() const noexcept { return i; }
    constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
  };
  constexpr rep(const usize first, const usize last) noexcept
      : f(first), l(last) {}
  constexpr itr begin() const noexcept { return itr(f); }
  constexpr itr end() const noexcept { return itr(l); }
};
class revrep {
  const usize f, l;

public:
  class itr {
    friend revrep;
    usize i;
    constexpr itr(usize x) noexcept : i(x) {}

  public:
    void operator++() noexcept { --i; }
    constexpr usize operator*() const noexcept { return i; }
    constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
  };
  constexpr revrep(usize first, usize last) noexcept : f(--first), l(--last) {}
  constexpr itr begin() const noexcept { return itr(l); }
  constexpr itr end() const noexcept { return itr(f); }
};
template <class T> using vec_alias = std::vector<T>;
template <class T> auto md_vec(const usize n, const T &value) {
  return std::vector<T>(n, value);
}
template <class... Args> auto md_vec(const usize n, Args... args) {
  return std::vector<decltype(md_vec(args...))>(n, md_vec(args...));
}
template <class T> constexpr T difference(const T &a, const T &b) {
  return a < b ? b - a : a - b;
}

} // namespace n91

#include <cassert>
#include <cstdint>

template <std::uint_fast64_t Modulus> class modint {
  using i64 = std::int_fast64_t;
  using u64 = std::uint_fast64_t;

  static_assert(Modulus < static_cast<u64>(1) << 32,
                "Modulus must be less than 2^32");

  static constexpr u64 normalize(i64 x) noexcept {
    x %= Modulus;
    if (x < 0) {
      x += Modulus;
    }
    return x;
  }

  u64 a;

  constexpr modint &negate() noexcept {
    if (a != 0) {
      a = Modulus - a;
    }
    return *this;
  }

public:
  constexpr modint(const i64 x = 0) noexcept : a(normalize(x)) {}

  constexpr u64 &value() noexcept { return a; }
  constexpr u64 value() const noexcept { return a; }

  constexpr modint &operator+=(const modint rhs) noexcept {
    a += rhs.a;
    if (a >= Modulus) {
      a -= Modulus;
    }
    return *this;
  }
  constexpr modint &operator-=(const modint rhs) noexcept {
    if (a < rhs.a) {
      a += Modulus;
    }
    a -= rhs.a;
    return *this;
  }
  constexpr modint &operator*=(const modint rhs) noexcept {
    a = a * rhs.a % Modulus;
    return *this;
  }
  constexpr modint &operator/=(modint rhs) noexcept {
    assert(("modint division by zero", rhs != 0));
    u64 exp = Modulus - 2;
    while (exp != 0) {
      if (exp % 2 == 1) {
        *this *= rhs;
      }
      rhs *= rhs;
      exp /= 2;
    }
    return *this;
  }

  constexpr modint operator++() noexcept {
    ++a;
    if (a == Modulus) {
      a = 0;
    }
    return *this;
  }
  constexpr modint operator--() noexcept {
    if (a == 0) {
      a = Modulus;
    }
    --a;
    return *this;
  }
  constexpr modint operator++(int) noexcept {
    modint old = *this;
    ++*this;
    return old;
  }
  constexpr modint operator--(int) noexcept {
    modint old = *this;
    --*this;
    return old;
  }

  constexpr modint operator+() const noexcept { return *this; }
  constexpr modint operator-() const noexcept { return modint(*this).negate(); }
  constexpr modint operator+(const modint rhs) const noexcept {
    return modint(*this) += rhs;
  }
  constexpr modint operator-(const modint rhs) const noexcept {
    return modint(*this) -= rhs;
  }
  constexpr modint operator*(const modint rhs) const noexcept {
    return modint(*this) *= rhs;
  }
  constexpr modint operator/(const modint rhs) const noexcept {
    return modint(*this) /= rhs;
  }

  constexpr bool operator==(const modint rhs) const noexcept {
    return a == rhs.a;
  }
  constexpr bool operator!=(const modint rhs) const noexcept {
    return a != rhs.a;
  }
};

#include <algorithm>
#include <iostream>
#include <set>
#include <string>
#include <utility>


namespace n91 {

void main_() {
  using mint = modint<1000000007>;
  usize n;
  std::cin >> n;
  std::vector<usize> a(n);
  for (auto &e : a) {
    std::cin >> e;
  }
  for (const auto i : rep(1, n)) {
    a[i] ^= a[i - 1];
  }
  struct node {
    usize lastc;
    mint zero, x;
    node() : lastc(0), zero(1), x(0) {}
  };
  std::vector<node> dp(static_cast<usize>(1) << 20);
  mint zcn = 1;
  usize count = 0;
  for (const auto i : rep(0, n - 1)) {
    if (a[i] == 0) {
      ++count;
      zcn *= 2;
    } else {
      auto &p = dp[a[i]];
      p.zero += p.x * (count - p.lastc);
      p.x += p.zero;
      p.lastc = count;
    }
  }
  mint ans = 0;
  if (a.back() != 0) {
    auto &p = dp[a.back()];
    ans += p.zero + p.x * (count - p.lastc);

  } else {
    for (const auto e : dp) {
      ans += e.x;
    }
    ans += zcn;
  }
  std::cout << ans.value() << std::endl;
}

} // namespace n91

int main() {
  n91::main_();
  return 0;
}


Measured memory_bytes: 28672