n = eval(input())

S = list(map(int,input().split()))

m = eval(input())

T = list(map(int,input().split()))

C=0

def binarySearch(A,p):

    lens = len(A)

    ll = -1

    ul = lens-1

    ms=(ll+ul)/2

    while (ll+1<ul):

    	ms=(ll+ul)/2

        if A[ms] >= p:

            ul =ms

        elif A[ms] < p:

            ll =ms

    return A[ul]==p



for item in T:

    if binarySearch(S,item):

        C += 1

print(C)
n = eval(input())

S = set([int(s) for s in input().split()])

m = eval(input())

T = set([int(s) for s in input().split()])

print(len(S&T))
n = eval(input())
S = list(map(int, input().split()))
m = eval(input())
T = list(map(int, input().split()))
C = 0


def binarySearch(A, p):
    lens = len(A)
    ll = -1
    ul = lens - 1
    ms = (ll + ul) / 2
    while ll + 1 < ul:
        ms = (ll + ul) / 2
        if A[ms] >= p:
            ul = ms
        elif A[ms] < p:
            ll = ms
    return A[ul] == p


for item in T:
    if binarySearch(S, item):
        C += 1
print(C)

n = eval(input())
S = set([int(s) for s in input().split()])
m = eval(input())
T = set([int(s) for s in input().split()])
print(len(S & T))

-S = list(map(int, input().split())) +S = set([int(s) for s in input().split()]) -T = list(map(int, input().split())) -C = 0 - - -def binarySearch(A, p): -    lens = len(A) -    ll = -1 -    ul = lens - 1 -    ms = (ll + ul) / 2 -    while ll + 1 < ul: -        ms = (ll + ul) / 2 -        if A[ms] >= p: -            ul = ms -        elif A[ms] < p: -            ll = ms -    return A[ul] == p - - -for item in T: -    if binarySearch(S, item): -        C += 1 -print(C) +T = set([int(s) for s in input().split()]) +print(len(S & T))