n = int( raw_input( ) )
s = [ int( val ) for val in raw_input( ).split( " " ) ]
q = int( raw_input( ) )
t = [ int( val ) for val in raw_input( ).split( " " ) ]
t.sort( )

cnt = 0
for ti in t:
	low = 0
	high = n - 1
	while low <= high:
		m = ( low+high )//2
		if ti < s[m]:
			high = m - 1
		elif s[m] < ti:
			low = m + 1
		else:
			cnt += 1
			break

print( cnt )