import sys

def binSearch(x,data):

    start = 0

    end = len(data)

    while start <= end:

        mid = int((start + end) / 2)

        if data[mid] == x:

            return 1

        elif int(data[mid]) > int(x):

            end = mid - 1

        else:

            start = mid + 1

    return 0

l = []

for i in sys.stdin:

    l.append(i)

l[1] = l[1].split()

l[3] = l[3].split()

count = 0

for i in range(0,len(l[3])):

    count += binSearch(l[3][i],l[1])

print(count)

def binSearch(l, x):

	u = 0

	d = len(l) - 1

	while True:

		if u > d:

			break

		m = int((u + d) / 2)

		if l[m] == x:

			return True

		elif l[m] < x:

			u = m + 1

		else:

			d = m - 1

	return False



n = int(eval(input()))

ni = [int(x) for x in input().split()]

q = int(eval(input()))

qi = [int(x) for x in input().split()]



print((sum([1 for x in qi if binSearch(ni, x) is True])))

import sys


def binSearch(x, data):
    start = 0
    end = len(data)
    while start <= end:
        mid = int((start + end) / 2)
        if data[mid] == x:
            return 1
        elif int(data[mid]) > int(x):
            end = mid - 1
        else:
            start = mid + 1
    return 0


l = []
for i in sys.stdin:
    l.append(i)
l[1] = l[1].split()
l[3] = l[3].split()
count = 0
for i in range(0, len(l[3])):
    count += binSearch(l[3][i], l[1])
print(count)

def binSearch(l, x):
    u = 0
    d = len(l) - 1
    while True:
        if u > d:
            break
        m = int((u + d) / 2)
        if l[m] == x:
            return True
        elif l[m] < x:
            u = m + 1
        else:
            d = m - 1
    return False


n = int(eval(input()))
ni = [int(x) for x in input().split()]
q = int(eval(input()))
qi = [int(x) for x in input().split()]
print((sum([1 for x in qi if binSearch(ni, x) is True])))

-import sys +def binSearch(l, x): +    u = 0 +    d = len(l) - 1 +    while True: +        if u > d: +            break +        m = int((u + d) / 2) +        if l[m] == x: +            return True +        elif l[m] < x: +            u = m + 1 +        else: +            d = m - 1 +    return False -def binSearch(x, data): -    start = 0 -    end = len(data) -    while start <= end: -        mid = int((start + end) / 2) -        if data[mid] == x: -            return 1 -        elif int(data[mid]) > int(x): -            end = mid - 1 -        else: -            start = mid + 1 -    return 0 - - -l = [] -for i in sys.stdin: -    l.append(i) -l[1] = l[1].split() -l[3] = l[3].split() -count = 0 -for i in range(0, len(l[3])): -    count += binSearch(l[3][i], l[1]) -print(count) +n = int(eval(input())) +ni = [int(x) for x in input().split()] +q = int(eval(input())) +qi = [int(x) for x in input().split()] +print((sum([1 for x in qi if binSearch(ni, x) is True])))