def main():
	num = 0

	_ = input()
	s_set = set(map(int, input().split()))

	_ = input()
	t_set = set(map(int, input().split()))
	for t in t_set:
		if t in s_set:
			num +=1
	
	print(num)

if __name__ == '__main__':
	main() def main():
	num = 0

	_ = input()
	s_set = set(map(int, input().split()))

	_ = input()
	t_set = set(map(int, input().split()))
	for t in t_set:
		if t in s_set:
			num +=1
	
	print(num) main num = 0 num 0 _ = input() _ input() input s_set = set(map(int, input().split())) s_set set(map(int, input().split())) set map(int, input().split()) map int input().split() ().split () input split _ = input() _ input() input t_set = set(map(int, input().split())) t_set set(map(int, input().split())) set map(int, input().split()) map int input().split() ().split () input split for t in t_set:
		if t in s_set:
			num +=1
	
	 t t_set if t in s_set:
			num +=1
	
	 t in s_set t s_set num +=1 num 1 print(num) print num if __name__ == '__main__':
	main() __name__ == '__main__' __name__ '__main__' main() main def main():
	num = 0

	_ = input()
	s_set = set(map(int, input().split()))

	_ = input()
	t_set = set(map(int, input().split()))
	for t in t_set:
		if t in s_set:
			num +=1
	
	print(num) def main():
	num = 0

	_ = input()
	s_set = set(map(int, input().split()))

	_ = input()
	t_set = set(map(int, input().split()))
	for t in t_set:
		if t in s_set:
			num +=1
	
	print(num) main
def main():
	num = 0

	_ = input()
	s_set = set(map(int, input().split()))

	_ = input()
	t_set = set(map(int, input().split()))
	for t in t_set:
		if t in s_set:
			num +=1
	
	print(num)

if __name__ == '__main__':
	main()