n = int(input()) input() A = list(map(int, input().split())) input() B = list(map(int, input().split())) se = {0} x = 0 for a in A: x += a se.add(x) for b in B: x -= b se.add(x) print(n + 1 - len(se))