#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #pragma warning(disable:4996) #define ATCODER #ifdef ATCODER #include #endif typedef long long ll; typedef unsigned long long ull; #define LINF 9223300000000000000 #define LINF2 1223300000000000000 #define LINF3 1000000000000 #define INF 2140000000 const long long MOD = 1000000007; //const long long MOD = 998244353; using namespace std; #ifdef ATCODER using namespace atcoder; #endif void solve() { int n; scanf("%d", &n); vector a(n), s(n + 1); for (int i = 0; i < n; i++) { scanf("%d", &a[i]); s[i + 1] = (s[i]^a[i]); } vector pr(n+1, -1); map z; // val->id for (int i = 1; i <= n; i++) { auto it = z.find(s[i]); if (it != z.end()) { pr[i] = it->second; } z[s[i]] = i; } vector dp(n + 1), sdp(n + 2); dp[0] = sdp[1] = 1; for (int i = 1; i <= n; i++) { int bgn = (pr[i] < 0 ? 0 : pr[i]); dp[i] = (sdp[i] - sdp[bgn] + MOD) % MOD; sdp[i + 1] = (sdp[i] + dp[i])%MOD; } printf("%lld\n", dp[n]); return; } int main() { #if 1 solve(); #else int T, t; scanf("%d", &T); for (t = 0; t < T; t++) { //cout << "Case #" << t + 1 << ": "; solve(); } #endif return 0; }