n = gets.chomp.to_i
s = gets.chomp.split(" ").map(&:to_i)
q = gets.chomp.to_i
t = gets.chomp.split(" ").map(&:to_i)

binarySearch = ->(key) {
  left = 0
  right = n
  while left < right
    mid = (left + right) / 2
    if key == s[mid] then
      return 1
    elsif key < s[mid] then
      right = mid
    elsif key > s[mid] then
      left = mid + 1
    end 
  end
  return 0
}

res = 0
t.each do |i|
  res += binarySearch.call(i)
end
puts res