def binarySearch(key, arr)
  if arr.size == 0 then
    false
  elsif arr.size == 1 then
    arr[0].to_i == key.to_i
  else
    m = arr.size / 2
    v = arr[m].to_i

    if key.to_i == v then
      true
    elsif key.to_i < v then
      binarySearch(key, arr.take(m))
    else
      binarySearch(key, arr.drop(m))
    end
  end
end


a_size = STDIN.gets.to_i
as = STDIN.gets.split(' ')

b_size = STDIN.gets.to_i
bs = STDIN.gets.split(' ')

n = 0
for i in bs
  if binarySearch(i, as) then
    n = n + 1
  end
end

puts n