#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve {
public:

    int tapi(vector<int> v) {
        int n = v.size();
        int ret = 0;
        for (int bit = 0; bit < (1 << (n - 1)); ++bit) {
            vector<int> w;
            int x = 0;
            for (int i = 0; i < n; ++i) {
                x ^= v[i];
                if (bit >> i & 1) {
                    w.push_back(x);
                    x = 0;
                }
            }
            w.push_back(x);
            sort(all(w));
            if (w.front() == w.back()) ret++;
        }
        return ret;
    }


    void jikken() {
        int N;
        cin >> N;

        vector<int> v(N);

        rep(i, 0, N) cin >> v[i];

        for (auto e : v) {
            cout << e << " ";
        }
        cout << endl;

        int x = 0;
        for (auto e : v) {
            x ^= e;
            cout << x << " ";
        }
        cout << endl;

        vector<int> w;
        for (auto e : v) {
            w.push_back(e);
            int tmp = tapi(w);
            cout << tmp << " ";
        }
        cout << endl;

    }

    int N;
    vector<int> v;
    vector<int> b;

    void input() {
        cin >> N;
        v.resize(N);
        b.resize(N);
        for (int i = 0; i < N; ++i) {
            cin >> v[i];
        }
        b[0] = v[0];
        for (int i = 1; i < N; ++i) {
            b[i] = b[i - 1] ^ v[i];
        }
    }


    template<typename T>
    //templateをつかってみｔか
    ll pow(T x, int y) {
        if (y == 0) return 1;
        if (y == 1) return x;
        if (y == 2) return (x * x) % MOD;
//        if (y % 2 == 1) return pow(b, y / 2) * pow(b, y / 2) % MOD;
        if (y % 2 == 1) return pow(pow(x, y / 2), 2) * x % MOD;
//        return pow(b, y / 2) * pow(b, y / 2) % MOD;
        return pow(pow(x, y / 2), 2) % MOD;
    }

    void solve() {
        input();
        vector<ll> pdp0(1 << 20, 1), pdpx(1 << 20, 0);
        vector<ll> dp0(1 << 20, 1), dpx(1 << 20, 0), cnts(1 << 20);
        ll cnt = 0;
        for (int i = 0; i < N; ++i) {
            if (b[i] == 0) {
                cnt++;
            } else {
                int x = b[i];
                pdp0[x] = dp0[x];
                pdpx[x] = dpx[x];

                (dp0[x] += dpx[x] * (cnt - cnts[x])) %= MOD;
                (dpx[x] += dp0[x]) %= MOD;
                cnts[x] = cnt;
            }
        }
        if (b[N - 1] == 0) {
            ll ans = pow(2, cnt - 1);
            for (int i = 0; i < 1 << 20; ++i) {
                (ans += dpx[i]) %= MOD;
            }
            cout << ans << endl;
        } else {
//            ll ans = (dpx[b[N - 1]] - pdpx[b[N - 1]]) % MOD;
//            if (ans < 0) ans += MOD;
            cout << dp0[b[N-1]] << endl;
        }

    }
};


int main() {
//    cin.tie(0);
//    ios::sync_with_stdio(false);
//    cout << fixed << setprecision(10);

    Solve().solve();


    return 0;
}


Measured memory_bytes: 29432