s_num = gets.to_i
s_arr = gets.split.map(&:to_i)
t_num = gets.to_i
t_arr = gets.split.map(&:to_i)

cnt = 0

for t in t_arr do
  s_idx = 0
  e_idx = s_num - 1
  
  while s_idx <= e_idx do
    mid_idx = ((e_idx - s_idx) / 2).to_i + s_idx
    s_mid = s_arr[mid_idx]
    
    if s_mid == t then
      cnt += 1
      break
    end
    if s_idx === e_idx then
      break
    end
    if t < s_mid then
      e_idx = mid_idx - 1
    else
      s_idx = mid_idx + 1
    end
  end
end

puts cnt