#!/usr/bin/env python
#-*- coding:utf-8 -*-

def linearSearch(arr,key):
	arr.append(int(key))
	for idx,a in enumerate(arr):
		if a == key:
			if idx == (len(arr) - 1):
				return -1
			else :
				return 1
	
def main():
	Ns = int(raw_input())
	S  = map(int, raw_input().split())
	Nt = int(raw_input())
	T  = map(int, raw_input().split())

	sum_v = 0
	for key  in T:
		if linearSearch(S,key) > 0:
			sum_v += 1

	print sum_v

#def test():

if __name__ == '__main__':
	main()
	#test() def linearSearch(arr,key):
	arr.append(int(key))
	for idx,a in enumerate(arr):
		if a == key:
			if idx == (len(arr) - 1):
				return -1
			else :
				return 1
	 linearSearch arr.append(int(key)) arr.append arr append int(key) int key for idx,a in enumerate(arr):
		if a == key:
			if idx == (len(arr) - 1):
				return -1
			else :
				return 1
	 idx a enumerate(arr) enumerate arr if a == key:
			if idx == (len(arr) - 1):
				return -1
			else :
				return 1
	 a == key a key if idx == (len(arr) - 1):
				return -1
			else :
				return 1
	 idx == (len(arr) - 1) idx len(arr) - 1 len(arr) len arr 1 return -1 -1 return 1 1 arr arr key key def main():
	Ns = int(raw_input())
	S  = map(int, raw_input().split())
	Nt = int(raw_input())
	T  = map(int, raw_input().split())

	sum_v = 0
	for key  in T:
		if linearSearch(S,key) > 0:
			sum_v += 1

	print sum_v

#def test(): main Ns = int(raw_input()) Ns int(raw_input()) int raw_input() raw_input S  = map(int, raw_input().split()) S map(int, raw_input().split()) map int raw_input().split() ().split () raw_input split Nt = int(raw_input()) Nt int(raw_input()) int raw_input() raw_input T  = map(int, raw_input().split()) T map(int, raw_input().split()) map int raw_input().split() ().split () raw_input split sum_v = 0 sum_v 0 for key  in T:
		if linearSearch(S,key) > 0:
			sum_v += 1

	 key T if linearSearch(S,key) > 0:
			sum_v += 1

	 linearSearch(S,key) > 0 linearSearch(S,key) linearSearch S key 0 sum_v += 1 sum_v 1 print if __name__ == '__main__':
	main()
	#test() __name__ == '__main__' __name__ '__main__' main() main def linearSearch(arr,key):
	arr.append(int(key))
	for idx,a in enumerate(arr):
		if a == key:
			if idx == (len(arr) - 1):
				return -1
			else :
				return 1
	 def linearSearch(arr,key):
	arr.append(int(key))
	for idx,a in enumerate(arr):
		if a == key:
			if idx == (len(arr) - 1):
				return -1
			else :
				return 1
	 linearSearch def main():
	Ns = int(raw_input())
	S  = map(int, raw_input().split())
	Nt = int(raw_input())
	T  = map(int, raw_input().split())

	sum_v = 0
	for key  in T:
		if linearSearch(S,key) > 0:
			sum_v += 1

	print sum_v

#def test(): def main():
	Ns = int(raw_input())
	S  = map(int, raw_input().split())
	Nt = int(raw_input())
	T  = map(int, raw_input().split())

	sum_v = 0
	for key  in T:
		if linearSearch(S,key) > 0:
			sum_v += 1

	print sum_v

#def test(): main
#!/usr/bin/env python
#-*- coding:utf-8 -*-

def linearSearch(arr,key):
	arr.append(int(key))
	for idx,a in enumerate(arr):
		if a == key:
			if idx == (len(arr) - 1):
				return -1
			else :
				return 1
	
def main():
	Ns = int(raw_input())
	S  = map(int, raw_input().split())
	Nt = int(raw_input())
	T  = map(int, raw_input().split())

	sum_v = 0
	for key  in T:
		if linearSearch(S,key) > 0:
			sum_v += 1

	print sum_v

#def test():

if __name__ == '__main__':
	main()
	#test()