#binarysearch.rb
#
def binary_search(arr ,key ,n)
  left=0
  right=n

  while left < right
    mid = (left+right)/2
    if(arr[mid]==key)
      return(mid)
    elsif key < arr[mid]
      right = mid
    else
      left = mid+1
    end
  end
  return(-1)
end

s=Array.new(100000)
t=Array.new(50000)

n=STDIN.gets.split[0].to_i
str=STDIN.gets.split
0.upto(n-1) {|i|
  s[i] = str[i].to_i
} 
q=STDIN.gets.split[0].to_i
str=STDIN.gets.split
0.upto(q-1) {|i|
  t[i] = str[i].to_i
} 
c=0
0.upto(q-1) {|i|
  ret=binary_search(s,t[i],n)

  if ret > -1 then
    #printf("%d %d\n",t[i],ret)
    c+=1
  end

} 
puts c