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

if(defined? MODE)
  line = STDIN.read.split("\n")
else
  tmp = '3
  3 1 2
  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
(0...n).each do |i|
  (0...m).each do |k|
    if arr1[i]==arr2[k]
      cnt+=1
    end
  end
end
puts cnt