# -*- coding: utf-8 -*-
"""
Created on Mon Apr 30 11:23:30 2018
ALDS1-4a most simple implementation using the features of the python
@author: maezawa
"""

n = int(input())
s = map(int, input().split())
q = int(input())
t = map(int, input().split())

s_set = set(s)
t_set = set(t)
sandt = s_set & t_set
print(len(sandt)) """
Created on Mon Apr 30 11:23:30 2018
ALDS1-4a most simple implementation using the features of the python
@author: maezawa
""" n = int(input()) n int(input()) int input() input s = map(int, input().split()) s map(int, input().split()) map int input().split() ().split () input split q = int(input()) q int(input()) int input() input t = map(int, input().split()) t map(int, input().split()) map int input().split() ().split () input split s_set = set(s) s_set set(s) set s t_set = set(t) t_set set(t) set t sandt = s_set & t_set sandt s_set & t_set s_set t_set print(len(sandt)) print len(sandt) len sandt t = map(int, input().split()) map(int, input().split()) t n = int(input()) int(input()) n s = map(int, input().split()) map(int, input().split()) s t_set = set(t) set(t) t_set s_set = set(s) set(s) s_set q = int(input()) int(input()) q sandt = s_set & t_set s_set & t_set sandt
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 30 11:23:30 2018
ALDS1-4a most simple implementation using the features of the python
@author: maezawa
"""

n = int(input())
s = map(int, input().split())
q = int(input())
t = map(int, input().split())

s_set = set(s)
t_set = set(t)
sandt = s_set & t_set
print(len(sandt))
