#include using namespace std; int main() { int n; cin >> n; vector dirty(n + 1, false); dirty[0] = true; int m; cin >> m; int cur = 0; for (int i = 0; i < m; i++) { int a; cin >> a; cur += a; dirty[cur] = true; } cin >> m; for (int i = 0; i < m; i++) { int b; cin >> b; cur -= b; dirty[cur] = true; } int ans = 0; for (const auto &d : dirty) { ans += !d; } cout << ans << '\n'; return 0; }