#include <bits/stdc++.h>

using std::cin;
using std::cout;
using std::cerr;

using std::vector;
using std::map;
using std::array;
using std::set;
using std::string;

using std::pair;
using std::make_pair;

using std::tuple;
using std::make_tuple;
using std::get;

using std::min;
using std::abs;
using std::max;
using std::swap;

using std::unique;
using std::sort;
using std::generate;
using std::reverse;
using std::min_element;
using std::max_element;

#ifdef LOCAL
#define LASSERT(X) assert(X)
#else
#define LASSERT(X) {}
#endif

template <typename T>
T input() {
    T res;
    cin >> res;
    LASSERT(cin);
    return res;
}

template <typename IT>
void input_seq(IT b, IT e) {
    std::generate(b, e, input<typename std::remove_reference<decltype(*b)>::type>);
}

#define SZ(vec)         int((vec).size())
#define ALL(data)       data.begin(),data.end()
#define RALL(data)      data.rbegin(),data.rend()
#define TYPEMAX(type)   std::numeric_limits<type>::max()
#define TYPEMIN(type)   std::numeric_limits<type>::min()

const int mod = 1000 * 1000 * 1000 + 7;
int add(int a, int b) {
    return (a + b >= mod ? a + b - mod : a + b);
}

int sub(int a, int b) {
    return (a >= b ? a - b : mod + a - b);
}

int mult(int a, int b) {
    return (int64_t(a) * b) % mod;
}

int main() {
    std::iostream::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    // code here
    int n = input<int>();
    vector<int> a(n);
    
    for (int& elem: a)
        elem = input<int>();

    vector<int> prefix(n + 1);
    for (int i = 0; i != n; ++i)
        prefix[i + 1] = prefix[i] xor a[i];

    vector<int> zero_cnt(n + 1);
    zero_cnt[0] = 1;
    for (int i = 1; i <= n; ++i)
        zero_cnt[i] = zero_cnt[i - 1] + int(prefix[i] == 0);
    
    int ans = 0;
    
    if (prefix.back() == 0) {
        // try making even

        // try zeros.
        if (1) {
            int zeros = zero_cnt.back() - 2;
            assert(zeros >= 0);

            if (zeros > 0) {
                int pw = 1;
                for (int i = 0; i != zeros - 1; ++i)
                    pw = add(pw, pw);

                ans = add(ans, pw);
            }
        }

        std::map<int, vector<int>> mp;
        for (int i = 1; i <= n; ++i)
            if (prefix[i] != 0)
                mp[prefix[i]].push_back(i);

        auto calc_zero = [&](int l, int r) {
            return zero_cnt[r] - (l == 0 ? 0 : zero_cnt[l - 1]);
        };
        
        for (auto& elem: mp) {
            // (elem.first, 0).
            pair<int, int> dp = {0, 1};

            for (int i = 0; i != SZ(elem.second); ++i) {
                if (i != 0) {
                    int prev = elem.second[i - 1];
                    int we = elem.second[i];

                    if (prev != we - 1) {
                        dp.second = add(dp.second, mult(dp.first, calc_zero(prev, we)));
                    }
                }

                dp.first = add(dp.first, dp.second);
            }

            ans = add(ans, dp.first);
        }
    }

    if (1) {
        // try making odd.
        
        int xr = prefix.back();

        // (end with xr, end with 0).
        pair<int, int> dp = {0, 1};

        for (int i = 1; i <= n; ++i) {
            auto new_dp = dp;
            
            if (prefix[i] == xr) {
                new_dp.first = add(new_dp.first, dp.second);
            }

            if (prefix[i] == 0) {
                new_dp.second = add(new_dp.second, dp.first);
            }

            if (i == n)
                ans = add(ans, sub(new_dp.first, dp.first));
            
            dp = new_dp;
        }
    }

    cout << ans << "\n";
    
    return 0;
}


Measured memory_bytes: 37504