class String
  def to_ia
    split(/\s/).map {|s| s.to_i}
  end
end
  
def linear_search(subjcet, search)
  hash = {}
  subjcet.each do |k|
    hash[k] = true
  end
  ans = 0
  search.each do |s|
    ans += 1 if subjcet[s]
  end
  ans
end

STDIN.readline
subjcet = STDIN.readline.to_ia
STDIN.readline
search = STDIN.readline.to_ia

puts linear_search(subjcet, search)