import sys





def binsearch(x, s):

    l = 0

    r = len(s)

    while (l < r):

        m = int((l + r) / 2)

        if s[m] == x:

            return True

        else:

            if s[m] < x:

                l = m + 1

            else:

                r = m

    return False





ns = sys.stdin.readline()

s = [int(i) for i in sys.stdin.readline().split()]

nt = sys.stdin.readline()

t = [int(i) for i in sys.stdin.readline().split()]



cnt = 0

for x in t:

    if binsearch(x, s):

        cnt += 1

print(cnt)
n = int(eval(input()))

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

q = int(eval(input()))

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





def search(a, X):

  l = 0

  r = len(X) 

  while l < r:

    m = (l + r ) // 2

    if a == X[m]:

      return m

    elif a > X[m]:

      l = m + 1

    elif a < X[m]:

      r = m

  return None

    



s = 0

for t in T:

  if search(t,S) is not None:

    s += 1

print(s)









import sys


def binsearch(x, s):
    l = 0
    r = len(s)
    while l < r:
        m = int((l + r) / 2)
        if s[m] == x:
            return True
        else:
            if s[m] < x:
                l = m + 1
            else:
                r = m
    return False


ns = sys.stdin.readline()
s = [int(i) for i in sys.stdin.readline().split()]
nt = sys.stdin.readline()
t = [int(i) for i in sys.stdin.readline().split()]
cnt = 0
for x in t:
    if binsearch(x, s):
        cnt += 1
print(cnt)

n = int(eval(input()))
S = list(map(int, input().split()))
q = int(eval(input()))
T = list(map(int, input().split()))


def search(a, X):
    l = 0
    r = len(X)
    while l < r:
        m = (l + r) // 2
        if a == X[m]:
            return m
        elif a > X[m]:
            l = m + 1
        elif a < X[m]:
            r = m
    return None


s = 0
for t in T:
    if search(t, S) is not None:
        s += 1
print(s)

-import sys +n = int(eval(input())) +S = list(map(int, input().split())) +q = int(eval(input())) +T = list(map(int, input().split())) -def binsearch(x, s): +def search(a, X): -    r = len(s) +    r = len(X) -        m = int((l + r) / 2) -        if s[m] == x: -            return True -        else: -            if s[m] < x: -                l = m + 1 -            else: -                r = m -    return False +        m = (l + r) // 2 +        if a == X[m]: +            return m +        elif a > X[m]: +            l = m + 1 +        elif a < X[m]: +            r = m +    return None -ns = sys.stdin.readline() -s = [int(i) for i in sys.stdin.readline().split()] -nt = sys.stdin.readline() -t = [int(i) for i in sys.stdin.readline().split()] -cnt = 0 -for x in t: -    if binsearch(x, s): -        cnt += 1 -print(cnt) +s = 0 +for t in T: +    if search(t, S) is not None: +        s += 1 +print(s)