S_num = int(input())
seq_S = set(input().split(" "))
T_num = int(input())
seq_T = set(input().split(" "))

seq_Both = seq_S & seq_T

print(len(seq_Both)) S_num = int(input()) S_num int(input()) int input() input seq_S = set(input().split(" ")) seq_S set(input().split(" ")) set input().split(" ") ().split () input split " " T_num = int(input()) T_num int(input()) int input() input seq_T = set(input().split(" ")) seq_T set(input().split(" ")) set input().split(" ") ().split () input split " " seq_Both = seq_S & seq_T seq_Both seq_S & seq_T seq_S seq_T print(len(seq_Both)) print len(seq_Both) len seq_Both S_num = int(input()) int(input()) S_num seq_Both = seq_S & seq_T seq_S & seq_T seq_Both T_num = int(input()) int(input()) T_num seq_S = set(input().split(" ")) set(input().split(" ")) seq_S seq_T = set(input().split(" ")) set(input().split(" ")) seq_T
S_num = int(input())
seq_S = set(input().split(" "))
T_num = int(input())
seq_T = set(input().split(" "))

seq_Both = seq_S & seq_T

print(len(seq_Both))