#include using namespace std; int main() { int n; cin >> n; vector a(n), b(n); for (auto &p: {&a, &b}) for (int &x: *p) cin >> x; int res = 0; for (int i = 0; i < n; ++i) { int sm = 0, xo = 0, no = 0; for (int j = i; j < n; ++j) { sm += a[j], xo ^= a[j], no ^= b[j]; if (sm != xo) break; if (sm - xo == no) ++res; } } cout << res; return 0; }