use std::collections::HashSet; fn g() -> Vec { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); s.split_whitespace().flat_map(str::parse).collect() } fn main() { let n: usize = g()[0] + 1; g(); let a = g(); g(); let b = g(); let mut h = HashSet::new(); let mut c = 0; for a in a { c += a; h.insert(c); } for b in b { c -= b; h.insert(c); } println!("{}", n - h.len()) }