# AOJ ALDS1_4_B Binary Search

# Python3 2018.7.3 bal4u



import sys

from sys import stdin

input = stdin.readline



n = int(eval(input()))

s = set(map(int, input().split()))

q = int(eval(input()))

t = set(map(int, input().split()))

print((len(s & t)))

# AOJ ALDS1_4_B Binary Search

# Python3 2018.7.3 bal4u



n = eval(input())

s = set(input().split())

q = eval(input())

t = set(input().split())

print((len(s & t)))

# AOJ ALDS1_4_B Binary Search
# Python3 2018.7.3 bal4u
import sys
from sys import stdin

input = stdin.readline
n = int(eval(input()))
s = set(map(int, input().split()))
q = int(eval(input()))
t = set(map(int, input().split()))
print((len(s & t)))

# AOJ ALDS1_4_B Binary Search
# Python3 2018.7.3 bal4u
n = eval(input())
s = set(input().split())
q = eval(input())
t = set(input().split())
print((len(s & t)))

-import sys -from sys import stdin - -input = stdin.readline -n = int(eval(input())) -s = set(map(int, input().split())) -q = int(eval(input())) -t = set(map(int, input().split())) +n = eval(input()) +s = set(input().split()) +q = eval(input()) +t = set(input().split())