import sys input = lambda :sys.stdin.readline()[:-1] ni = lambda :int(input()) na = lambda :list(map(int,input().split())) yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES") no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO") ####################################################################### n = ni() b = [1] * (1+n) m = ni() a = na() s = 0 for i in range(m): s += a[i] b[s] = 0 m = ni() a = na() for i in range(m): s -= a[i] b[s] = 0 print(sum(b))