use std::io::*;
use std::ops::*;
use std::str::FromStr;
use utils::*;

pub fn main() {
    let i = stdin();
    let mut o = Vec::new();
    run(i.lock(), &mut o);
    stdout().write_all(&o).unwrap();
}

fn run<R: BufRead, W: Write>(i: R, o: &mut W) {
    let mut i = CpReader::new(i);
    let n = i.read::<usize>();
    let a = i.read_vec::<u32>(n);

    writeln!(o, "{}", solve(a)).unwrap();
}
fn solve(mut a: Vec<u32>) -> usize {
    let mut x = 0;
    for a in a.iter_mut() {
        x ^= *a;
        *a = x;
    }
    if x == 0 {
        let mut to_idx = vec![u32::max_value(); 2usize.pow(20)];
        to_idx[0] = 0;

        let mut dp_len = 1;
        for &a in &a {
            let idx = &mut to_idx[a as usize];
            if *idx == u32::max_value() {
                *idx = dp_len;
                dp_len += 1;
            }
        }

        #[derive(Copy, Clone)]
        struct Dp {
            count_0: Mod,
            count_x: Mod,
            zeros: usize,
        }
        let dp_init = Dp {
            count_0: Mod::new(1),
            count_x: Mod::new(0),
            zeros: 0,
        };
        let mut dp = vec![dp_init; dp_len as usize];

        let mut zeros = 0;
        for &a in &a {
            if a == 0 {
                zeros += 1;
            } else {
                let dp = &mut dp[to_idx[a as usize] as usize];
                dp.count_0 += dp.count_x * (zeros - dp.zeros);
                dp.zeros = zeros;
                dp.count_x += dp.count_0;
            }
        }

        let mut sum = Mod::new(0);
        for dp in dp {
            sum += dp.count_x;
        }
        sum += Mod::new(2).pow(zeros - 1);
        sum.0

    } else {
        let mut count_0 = Mod::new(1);
        let mut count_x = Mod::new(0);
        for &a in &a {
            if a == 0 {
                count_0 += count_x;
            } else if a == x {
                count_x += count_0;
            }
        }
        count_0.0
    }
}

mod utils {
    use super::*;

    pub struct CpReader<R: BufRead> {
        r: R,
        s: String,
    }

    macro_rules! fn_read {
        { $f:ident($($t:ident),*) } => {
            #[allow(dead_code)]
            pub fn $f<$($t: FromStr),*>(&mut self) -> ($($t),*) {
                let i = &mut self.read_line().split(' ');
                ($(read_next::<$t,_>(i)),*)
            }
        };
    }

    impl<R: BufRead> CpReader<R> {
        pub fn new(r: R) -> Self {
            CpReader {
                r: r,
                s: String::new(),
            }
        }
        pub fn read_line(&mut self) -> &str {
            self.s.clear();
            self.r.read_line(&mut self.s).unwrap();
            self.s.trim()
        }

        pub fn read<T: FromStr>(&mut self) -> T {
            self.read_line().parse().ok().unwrap()
        }
        fn_read! { read2(T1, T2) }
        fn_read! { read3(T1, T2, T3) }
        fn_read! { read4(T1, T2, T3, T4) }
        fn_read! { read5(T1, T2, T3, T4, T5) }

        pub fn read_vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
            let mut v = Vec::with_capacity(n);
            v.extend(
                self.read_line()
                    .split(' ')
                    .take(n)
                    .map(|x| x.parse().ok().unwrap()),
            );
            v
        }
    }
    fn read_next<'a, T: FromStr, I: Iterator<Item = &'a str>>(i: &mut I) -> T {
        i.next().unwrap().parse().ok().unwrap()
    }

    #[derive(Clone, Copy)]
    pub struct Mod(pub usize);

    use std::fmt;
    impl fmt::Debug for Mod {
        fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
            write!(f, "{:?}", self.0)
        }
    }

    const MOD_BASE: usize = 1000000007;
    const MOD_INV_POW: usize = 1000000005;

    impl Mod {
        pub fn new(n: usize) -> Self {
            Mod(n % MOD_BASE)
        }
        pub fn pow(self, mut exp: usize) -> Self {
            let mut b = self;
            let mut r = Mod(1);
            while exp != 0 {
                if exp % 2 == 1 {
                    r *= b;
                }
                exp /= 2;
                b = b * b;
            }
            r
        }
        pub fn inverse_element(self) -> Self {
            self.pow(MOD_INV_POW)
        }
    }

    macro_rules! mod_op {
        (($ot:ident, $f:ident), ($ot_a:ident, $f_a:ident), $($rhs:ty : $e:expr,)*) => {
            $(
            impl $ot<$rhs> for Mod {
                type Output = Self;
                fn $f(self, rhs: $rhs) -> Self {
                    ($e)(self, rhs)
                }
            }
            impl $ot_a<$rhs> for Mod {
                fn $f_a(&mut self, rhs: $rhs) {
                    *self = ($e)(*self, rhs)
                }
            }
            )*
        }
    }

    mod_op!(
        (Add, add),
        (AddAssign, add_assign),
        Mod : |l: Mod, r: Mod| Mod::new(l.0 + r.0),
        usize : |l: Mod, r: usize| l + Mod::new(r),
    );

    mod_op!(
        (Mul, mul),
        (MulAssign, mul_assign),
        Mod : |l: Mod, r: Mod| Mod::new(l.0 * r.0),
        usize : |l: Mod, r: usize| l * Mod::new(r),
    );

    mod_op!(
        (Sub, sub),
        (SubAssign, sub_assign),
        Mod : |l: Mod, r: Mod| Mod::new(MOD_BASE + l.0 - r.0),
        usize : |l: Mod, r: usize| l - Mod::new(r),
    );

    mod_op!(
        (Div, div),
        (DivAssign, div_assign),
        Mod : |l: Mod, r: Mod| l * r.inverse_element(),
        usize : |l: Mod, r: usize| l / Mod::new(r),
    );

}


Measured memory_bytes: 23800