Language: C++

#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cout << #x << " = " << (x) << endl;
using Graph = vector<vector<int> >;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//#define int long long

template<int MOD> struct Fp {
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
        if (val < 0) v += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator - () const noexcept {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
        return os << x.val;
    }
    friend constexpr istream& operator >> (istream &is, Fp<MOD>& x) noexcept {
        return is >> x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
};
const int MOD = 1000000007;
using mint = Fp<MOD>;

int n;
vector<int> a, s; //sはaのxorの累積
vector<int> zs; //累積を考えて、[0, i)なるs_k = 0の個数
vector<vector<int>> inds; //s_i == dなるindex

mint subsolve(int d, bool iszero = 1) { //d != 0
    auto p = inds[d];
    int k = (int)p.size();
    vector<int> q(k + 1, 0);
    rep(i, k) {
        q[i] = zs[p[i]] - zs[p[0]];
    }

    vector<mint> dp(k, 0), sdp(k + 1, 0), sdp2(k + 1, 0);
    dp[0] = 1;
    sdp[1] = sdp[0] + dp[0];
    sdp2[1] = sdp2[0] + dp[0] * q[0];
    rep(i, k - 1) {
        dp[i + 1] = 1 + q[i + 1] * sdp[i + 1] - sdp2[i + 1];
        sdp[i + 2] = sdp[i + 1] + dp[i + 1];
        sdp2[i + 2] = sdp2[i + 1] + q[i + 1] * dp[i + 1];
    }
    mint res = 0;
    if(iszero) {
        rep(i, k) {
            res += dp[i];
        }
    } else {
        res = dp.back();
    }

    return res;
}

void solve() {
	cin >> n;
    a.resize(n);
    rep(i, n) {
        cin >> a[i];
    }
    s.assign(n + 1, 0);
    rep(i, n) {
        s[i + 1] = s[i] ^ a[i];
    }
    zs.assign(n + 2, 0);
    rep(i, n + 1) {
        zs[i + 1] = zs[i] + (s[i] == 0);
    }
    inds.assign((1<<20) + 1, vector<int>());
    rep(i, n + 1) {
        inds[s[i]].push_back(i);
    }

    mint ans = 0;
    if(s.back() == 0) {
        int zeronum = (int)inds[0].size() - 2;
        ans += modpow(mint(2), zeronum);
        for(int d = 1; d <= (1<<20); ++d) {
            if(inds[d].empty()) continue;
            ans += subsolve(d);
        }
    } else {
        ans = subsolve(s.back(), 0);
    }

    cout << ans << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	solve();
	//cout << "finish" << endl;
    return 0;
}

Compiler output:
a.cc: In function 'mint subsolve(int, bool)':
a.cc:132:34: error: no match for 'operator*' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} and '__gnu_cxx::__alloc_traits<std::allocator<Fp<1000000007> >, Fp<1000000007> >::value_type' {aka 'Fp<1000000007>'})
  132 |         dp[i + 1] = 1 + q[i + 1] * sdp[i + 1] - sdp2[i + 1];
In file included from a.cc:16:
/usr/include/c++/14/complex:400:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator*(const complex<_Tp>&, const complex<_Tp>&)'
  400 |     operator*(const complex<_Tp>& __x, const complex<_Tp>& __y)
      |     ^~~~~~~~
/usr/include/c++/14/complex:400:5: note:   template argument deduction/substitution failed:
a.cc:132:45: note:   mismatched types 'const std::complex<_Tp>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
  132 |         dp[i + 1] = 1 + q[i + 1] * sdp[i + 1] - sdp2[i + 1];
      |                                             ^
/usr/include/c++/14/complex:409:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator*(const complex<_Tp>&, const _Tp&)'
  409 |     operator*(const complex<_Tp>& __x, const _Tp& __y)
      |     ^~~~~~~~
/usr/include/c++/14/complex:409:5: note:   template argument deduction/substitution failed:
a.cc:132:45: note:   mismatched types 'const std::complex<_Tp>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
  132 |         dp[i + 1] = 1 + q[i + 1] * sdp[i + 1] - sdp2[i + 1];
      |                                             ^
/usr/include/c++/14/complex:418:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator*(const _Tp&, const complex<_Tp>&)'
  418 |     operator*(const _Tp& __x, const complex<_Tp>& __y)
      |     ^~~~~~~~
/usr/include/c++/14/complex:418:5: note:   template argument deduction/substitution failed:
a.cc:132:45: note:   '__gnu_cxx::__alloc_traits<std::allocator<Fp<1000000007> >, Fp<1000000007> >::value_type' {aka 'Fp<1000000007>'} is not derived from 'const std::complex<_Tp>'
  132 |         dp[i + 1] = 1 + q[i + 1] * sdp[i + 1] - sdp2[i + 1];
      |                                             ^
a.cc:134:46: error: no match for 'operator*' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} and '__gnu_cxx::__alloc_traits<std::allocator<Fp<1000000007> >, Fp<1000000007> >::value_type' {aka 'Fp<1000000007>'})
  134 |         sdp2[i + 2] = sdp2[i + 1] + q[i + 1] * dp[i + 1];
/usr/include/c++/14/complex:400:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator*(const complex<_Tp>&, const complex<_Tp>&)'
  400 |     operator*(const complex<_Tp>& __x, const complex<_Tp>& __y)
      |     ^~~~~~~~
/usr/include/c++/14/complex:400:5: note:   template argument deduction/substitution failed:
a.cc:134:56: note:   mismatched types 'const std::complex<_Tp>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
  134 |         sdp2[i + 2] = sdp2[i + 1] + q[i + 1] * dp[i + 1];
      |                                                        ^
/usr/include/c++/14/complex:409:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator*(const complex<_Tp>&, const _Tp&)'
  409 |     operator*(const complex<_Tp>& __x, const _Tp& __y)
      |     ^~~~~~~~
/usr/include/c++/14/complex:409:5: note:   template argument deduction/substitution failed:
a.cc:134:56: note:   mismatched types 'const std::complex<_Tp>' and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
  134 |         sdp2[i + 2] = sdp2[i + 1] + q[i + 1] * dp[i + 1];
      |                                                        ^
/usr/include/c++/14/complex:418:5: note: candidate: 'template<class _Tp> std::complex<_Tp> std::operator*(const _Tp&, const complex<_Tp>&)'
  418 |     operator*(const _Tp& __x, const complex<_Tp>& __y)
      |     ^~~~~~~~
/usr/include/c++/14/complex:418:5: note:   template argument deduction/substitution failed:
a.cc:134:56: note:   '__gnu_cxx::__alloc_traits<std::allocator<Fp<1000000007> >, Fp<1000000007> >::value_type' {aka 'Fp<1000000007>'} is not derived from 'const std::complex<_Tp>'
  134 |         sdp2[i + 2] = sdp2[i + 1] + q[i + 1] * dp[i + 1];
      |                                                        ^