// ${url}
//
#![allow(unused_imports)]
use std::io::*;
use std::io::Write;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };

    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, [ next / $t:tt ]) => {
        {
            let len = read_value!($iter, usize);
            (0..len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
        }
    };

    ($iter:expr, switch) => {
        {
            let ty = read_value!($iter, i32);
            if ty == 1 {
                vec![ty, read_value!($iter, i32), read_value!($iter, i32)]
            } else if ty == 2 {
                vec![ty, read_value!($iter, i32)]
            } else {
                vec![ty, read_value!($iter, i32)]
            }
        }
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! dvec {
    ($t:expr ; $len:expr) => {
        vec![$t; $len]
    };

    ($t:expr ; $len:expr, $($rest:expr),*) => {
        vec![dvec!($t; $($rest),*); $len]
    };
}

#[allow(unused_macros)]
macro_rules! ifv {
    ($t:expr, $a:expr, $b: expr) => {
        if $t { $a } else { $b }
    }
}

#[allow(unused_macros)]
macro_rules! fill {
    ($t:expr, $v:expr) => {
        for i in 0..$t.len() {
            $t[i] = $v;
        }
    };
}

#[allow(unused_macros)]
macro_rules! join {
    ($t:expr, $glue:expr) => {
        $t.into_iter().map(|w| w.to_string()).collect::<Vec<_>>().join($glue)
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

// ===

const MOD: i64 = 1e9 as i64 + 7;

fn pow(a: i64, p: i64) -> i64 {
    let mut p = p;
    let mut aa = a;
    let mut ret = 1;
    while p >= 1 {
        if p & 1 == 1 {
            ret *= aa;
            ret %= MOD;
        }
        p >>= 1;
        aa = aa * aa % MOD;
    }
    ret
}

//===

fn doit(a: i32, pos: Vec<usize>, zero_sum: &Vec<i64>, last_is_zero: bool) -> i64 {
    let n = zero_sum.len()-1;
    let pn = pos.len();

    if a == 0 {
        assert!(last_is_zero);
        return pow(2, zero_sum[n]-1);
    }

    let mut dp_sum = 1;
    let mut addr = 1;

    let mut dp = vec![0; pn];
    dp[0] = 1;
    for i in 1..pn {
        let zcnt = zero_sum[pos[i]+1] - zero_sum[pos[i-1]];
        addr += dp_sum * zcnt % MOD;
        addr %= MOD;
        dp[i] = addr;
        dp_sum += addr;
        dp_sum %= MOD;
    }

    if last_is_zero {
        let mut total = 0;
        for f in 0..pn {
            total += dp[f];
        }
        total % MOD
    } else {
        dp[pn-1]
    }
}

fn main() {
    input! {
        n: usize,
        a: [i32; n]
    };

    let mut pos = vec![];
    let mut zero_sum = vec![0; n+1];
    let mut sum = 0;
    for i in 0..n {
        sum ^= a[i];
        pos.push((sum, i));
        zero_sum[i+1] += zero_sum[i];
        if sum == 0 {
            zero_sum[i+1] += 1;
        }
    }

    pos.sort();


    let mut ans = 0;
    {
        let mut fr = 0;
        while fr < n {
            let mut to = fr;
            let mut v = vec![];
            while to < n && pos[fr].0 == pos[to].0 {
                v.push(pos[to].1);
                to += 1;
            }

            if sum == 0 || sum == pos[fr].0 {
                if v.len() >= 1 {
                    let f = doit(pos[fr].0, v, &zero_sum, sum == 0);
                    ans += f;
                    // debug!(pos[fr].0, f, v, sum);
                    ans %= MOD;
                }
            }

            fr = to;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 30960