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(a: &[u32]) -> usize {
    let mut b = 0;
    for i in 0..a.len() {
        b ^= a[i];
    }
    if b == 0 {
        #[derive(Copy, Clone)]
        struct DpItem {
            count_0: Mod,
            count_x: Mod,
            zeros: usize,
        }
        impl DpItem {
            fn new() -> Self {
                DpItem {
                    count_0: Mod::new(1),
                    count_x: Mod::new(0),
                    zeros: 0,
                }
            }
        }
        let mut b_to_idx = vec![u32::max_value(); 2usize.pow(20)];
        let mut dp = Vec::new();

        b_to_idx[0] = 0;
        dp.push(DpItem::new());

        let mut b = 0;
        for i in 0..a.len() {
            b ^= a[i];
            let idx = &mut b_to_idx[b as usize];
            if *idx == u32::max_value() {
                *idx = dp.len() as u32;
                dp.push(DpItem::new());
            }
        }

        let mut b = 0;
        let mut zeros = 0;
        for i in 0..a.len() {
            b ^= a[i];
            if b == 0 {
                zeros += 1;
            } else {
                let dp = &mut dp[b_to_idx[b 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);
        let x = b;
        let mut b = 0;
        for i in 0..a.len() {
            b ^= a[i];
            if b == 0 {
                count_0 += count_x;
            } else if b == 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> {
            self.read_line()
                .split(' ')
                .take(n)
                .map(|x| x.parse().ok().unwrap())
                .collect()
        }
    }
    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: 25836