n = int(input())
s = set(map(int, input().split()))
q = int(input())
t = set(map(int, input().split()))

ans = s & t
print(len(ans)) n = int(input()) n int(input()) int 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 = int(input()) q int(input()) int 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 ans = s & t ans s & t s t print(len(ans)) print len(ans) len ans ans = s & t s & t ans s = set(map(int, input().split())) set(map(int, input().split())) s q = int(input()) int(input()) q n = int(input()) int(input()) n t = set(map(int, input().split())) set(map(int, input().split())) t
n = int(input())
s = set(map(int, input().split()))
q = int(input())
t = set(map(int, input().split()))

ans = s & t
print(len(ans))
