N = input()
S = set(map(int, input().split()))
Q = input()
T = set(map(int, input().split()))


intersection = S & T
print(len(intersection)) N = input() N input() input S = set(map(int, input().split())) S set(map(int, input().split())) set map(int, input().split()) map int input().split() ().split () input split Q = input() Q input() input T = set(map(int, input().split())) T set(map(int, input().split())) set map(int, input().split()) map int input().split() ().split () input split intersection = S & T intersection S & T S T print(len(intersection)) print len(intersection) len intersection N = input() input() N S = set(map(int, input().split())) set(map(int, input().split())) S Q = input() input() Q intersection = S & T S & T intersection T = set(map(int, input().split())) set(map(int, input().split())) T
N = input()
S = set(map(int, input().split()))
Q = input()
T = set(map(int, input().split()))


intersection = S & T
print(len(intersection))
