n = gets.to_i
n.times{
  base = gets.chomp.split.map(&:to_i)
}
m = gets.to_i
m.times{
  compare = gets.chomp.split.map(&:to_i)
}
count = 0

(0..(n-1)).each do |i|
  left = 0
  right = n-1
  while left < right
    mid = (left+right)/2
    if base[mid] == m[i]
      count += 1
    elsif m[i] < base[mid]
      right = mid
    else
      left = mid + 1
    end
  end
end

puts count