#include using namespace std; int main() { int N; cin >> N; vector A(N), B(N); for (int &x : A) cin >> x; for (int &x : B) cin >> x; int cnt = 0; for (int i = 0; i < N; ++i) { int sumv = 0, xorv = 0; bool ok = true; for (int j = i; j < N; ++j) { sumv += A[j]; xorv ^= A[j]; if (B[j]) ok = false; if (sumv != xorv || !ok) break; ++cnt; } } cout << cnt << endl; }