#include using namespace std; using ll = long long; #define rep(i, s, e) for (int i = (int)s; i < (int)e; i++) int main() { cin.tie(nullptr); int N; cin >> N; vector clean(N + 1, true); clean[0] = false; int ans = N; int M1; cin >> M1; int now = 0; rep(i, 0, M1) { int A; cin >> A; now += A; clean[now] = false; ans--; } int M2; cin >> M2; rep(i, 0, M2) { int A; cin >> A; now -= A; if (clean[now]) ans--; } cout << ans << '\n'; }