_n = gets
s = gets.split(" ").uniq.map(&:to_i)
_q = gets
t = gets.split(" ").uniq.map(&:to_i)

count = 0

def binarySearch?(arr, key)
  mid = arr.size / 2
  # print "key: #{key}, arr: #{arr} \n"
  if key == arr[mid]
    return true
  elsif arr.size <= 1
    return false
  elsif key > arr[mid]
    binarySearch?(arr[mid+1..-1], key)
  elsif key < arr[mid]
    binarySearch?(arr[0...mid], key)
  end
end

t.each do |i|
  count += 1 if binarySearch?(s, i)
end

puts count

