MODE = "stdio"
#require 'matrix'
#include Math
line = Array.new

if(defined? MODE)
  line = STDIN.read.split("\n")
else
  tmp = '3
  1 2 3
  1
  5'.split("\n")
  tmp.each{|s|
    line << s.strip
  }
end

n = line[0].to_i
arr1 = line[1].split.map(&:to_i)
m = line[2].to_i
arr2 = line[3].split.map(&:to_i)


cnt = 0
arr2.each do |key|
  left = 0
  right = n
  while left<right
    mid = (left+right)/2
    if(arr1[mid]==key)
      cnt+=1
      break
    elsif key<arr1[mid]
      right = mid
    else
      left = mid+1
    end
  end
end
puts cnt