object Main {
  import java.io.{BufferedReader, InputStream, InputStreamReader}
  import java.util.StringTokenizer
  import scala.reflect.ClassTag

  def main(args: Array[String]): Unit = {
    val out = new java.io.PrintWriter(System.out)
    new Main(out, new InputReader(System.in)).solve()
    out.flush()
  }

  private val oj = System.getenv("ATCODER_DEBUG") == null
  def DEBUG(f: => Unit): Unit = {
    if (!oj){ f }
  }
  def debug(as: Array[Boolean]): Unit = if (!oj){ debug(as.map(x => if(x) "1" else "0").mkString) }
  def debug(as: Array[Int]): Unit = if (!oj){ debug(as.mkString(" ")) }
  def debug(as: Array[Long]): Unit =if (!oj){ debug(as.mkString(" ")) }
  def debugDim(m: Array[Array[Long]]): Unit = if (!oj){
    REP(m.length) { i =>
      debug(m(i))
    }
  }
  def debugDimFlip(m: Array[Array[Long]]): Unit = if (!oj){
    REP(m(0).length) { j =>
      REP(m.length) { i =>
        System.err.print(m(i)(j))
        System.err.print(" ")
      }
      System.err.println()
    }
  }
  def debug(s: => String): Unit = DEBUG {
    System.err.println(s)
  }
  def debugL(num: => Long): Unit = DEBUG {
    System.err.println(num)
  }

  class InputReader(val stream: InputStream) {
    private val reader = new BufferedReader(new InputStreamReader(stream), 32768)
    private var tokenizer: StringTokenizer = _

    def next(): String = {
      while (tokenizer == null || !tokenizer.hasMoreTokens)
        tokenizer = new StringTokenizer(reader.readLine)
      tokenizer.nextToken
    }

    def nextInt(): Int = Integer.parseInt(next())
    def nextLong(): Long = java.lang.Long.parseLong(next())
    def nextChar(): Char = next().charAt(0)

    def ni(): Int = nextInt()
    def nl(): Long = nextLong()
    def nc(): Char = nextChar()
    def ns(): String = next()
    def ns(n: Int): Array[Char] = ns().toCharArray
    def na(n: Int, offset: Int = 0): Array[Int] = map(n)(_ => ni() + offset)
    def na2(n: Int, offset: Int = 0): (Array[Int], Array[Int]) = {
      val A1, A2 = Array.ofDim[Int](n)
      REP(n) { i =>
        A1(i) = ni() + offset
        A2(i) = ni() + offset
      }
      (A1, A2)
    }
    def nm(n: Int, m: Int): Array[Array[Int]] = {
      val A = Array.ofDim[Int](n, m)
      REP(n) { i =>
        REP(m) { j =>
          A(i)(j) = ni()
        }
      }
      A
    }
    def nal(n: Int): Array[Long] = map(n)(_ => nl())
    def nm_c(n: Int, m: Int): Array[Array[Char]] = map(n) (_ => ns(m))
  }

  def REP(n: Int, offset: Int = 0)(f: Int => Unit): Unit = {
    var i = offset
    val N = n + offset
    while(i < N) { f(i); i += 1 }
  }
  def REP_r(n: Int, offset: Int = 0)(f: Int => Unit): Unit = {
    var i = n - 1 + offset
    while(i >= offset) { f(i); i -= 1 }
  }
  def TO(from: Int, to: Int)(f: Int => Unit): Unit = {
    REP(to - from + 1, from) { i =>
      f(i)
    }
  }
  def map[@specialized A: ClassTag](n: Int, offset: Int = 0)(f: Int => A): Array[A] = {
    val res = Array.ofDim[A](n)
    REP(n)(i => res(i) = f(i + offset))
    res
  }

  def sumL(as: Array[Int]): Long = {
    var s = 0L
    REP(as.length)(i => s += as(i))
    s
  }
  def cumXor(as: Array[Int]): Array[Int] = {
    val cum = Array.ofDim[Int](as.length + 1)
    REP(as.length) { i =>
      cum(i + 1) = cum(i) ^ as(i)
    }
    cum
  }
}

class Main(out: java.io.PrintWriter, sc: Main.InputReader) {
  import sc._
  import Main._
  import java.util.Arrays.sort

  import scala.collection.mutable
  import math.{abs, max, min}
  import mutable.ArrayBuffer

  // toIntとか+7とかするならvalにしろ
  @inline private def MOD = 1000000007

  def solve(): Unit = {
    val N = ni()
    val A = na(N)
    val cum = cumXor(A)
    debug("cum")
    debug(cum)
    val cum0 = Array.ofDim[Int](N + 2)
    val pos = Array.fill[ArrayBuffer[Int]](1 << 20)(ArrayBuffer())

    // cumに対してループする
    REP(N + 1) { i =>
      if (cum(i) != 0) pos(cum(i)) += i
      cum0(i + 1) = cum0(i) + (if (cum(i) == 0) 1 else 0)
    }
    debug("cum0")
    debug(cum0)

    DEBUG {
      REP(1 << 20) { i =>
        if (pos(i).nonEmpty) {
          debug(s"pos($i)")
          debug(pos(i).mkString(" "))
        }
      }
    }

    def count(x: Int): Array[Long] = {
      debug(s"count($x)")
      val P = pos(x)
      val n = P.length
      // 0は必ず最初の0が１ついるだけ
      val dp = Array.ofDim[Long](2) // 0: 0-1-0の組み合わせ, 1: 0-1の組み合わせ

      REP(2 * n) { i =>
        // 1
        if (i % 2 == 0) {
          dp(1) = (dp(1) + dp(0) + 1) % MOD

        // 0
        } else {
          val ii = i / 2
          val cnt = if (i == 2 * n - 1) {
            cum0(N + 1) - cum0(P.last)
          } else {
            cum0(P(ii + 1)) - cum0(P(ii))
          }

          dp(0) = (dp(0) + dp(1) * cnt) % MOD
        }
        debug(dp)
      }

      dp
    }

    if (cum(N) == 0) {
      var ans = 0L
      REP(pos.length) { i =>
        if (pos(i).nonEmpty) {
          ans += count(i)(1) // 途中で x状態になった数
        }
      }
      ans += powMod(2, cum0(N + 1) - 2, MOD) // x == 0の場合。最初、最後の0は選択できない
      out.println(ans % MOD)
    } else {
      // 全部をxorした結果がXなので、(X^X)* ^ X かならずこの形式になる
      out.println((count(cum(N))(0) + 1) % MOD) // 途中で0状態になった数。countは0-1-0の組みを返すので0を１つ足してやる
    }
  }

  def powMod(x: Int, n: Int, m: Int): Int = {
    def step(x: Long, n: Int, stack: Long): Long = {
      n match {
        case 0 => stack
        case _ => step(x * x % m, n / 2, if (n % 2 == 1) stack * x % m else stack)
      }
    }
    step(x, n, 1).toInt
  }
}

Measured memory_bytes: 250484