while True:
    try:
        n = int(input())
        S = list(map(int, input().split()))
        _ = int(input())
        print(sum([1 for t in list(map(int, input().split())) if t in S]))
    except:break while True:
    try:
        n = int(input())
        S = list(map(int, input().split()))
        _ = int(input())
        print(sum([1 for t in list(map(int, input().split())) if t in S]))
    except:break True try:
        n = int(input())
        S = list(map(int, input().split()))
        _ = int(input())
        print(sum([1 for t in list(map(int, input().split())) if t in S]))
    except:break except:break n = int(input()) n int(input()) int input() input S = list(map(int, input().split())) S list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split _ = int(input()) _ int(input()) int input() input 1 for t in list(map(int, input().split())) if t in S for t in list(map(int, input().split())) if t in S t list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split t in S t S if t in S 1 print(sum([1 for t in list(map(int, input().split())) if t in S])) print sum([1 for t in list(map(int, input().split())) if t in S]) sum [1 for t in list(map(int, input().split())) if t in S] n = int(input()) int(input()) n _ = int(input()) int(input()) _ S = list(map(int, input().split())) list(map(int, input().split())) S
while True:
    try:
        n = int(input())
        S = list(map(int, input().split()))
        _ = int(input())
        print(sum([1 for t in list(map(int, input().split())) if t in S]))
    except:break