#include #include using namespace std; using ll = long long; int main() { ll n; cin >> n; vector foot(n); ll m; cin >> m; ll now = 0; for (ll i = 0; i < m; i++) { ll a; cin >> a; foot[now] = true; now += a; } cin >> m; for (ll i = 0; i < m; i++) { ll b; cin >> b; now -= b; foot[now] = true; } ll ans = 0; for (ll i = 0; i < n; i++) ans += !foot[i]; cout << ans << "\n"; }