N = gets.chomp.to_i
S = gets.chomp.split.map(&:to_i)
Q = gets.chomp.to_i
T = gets.chomp.split.map(&:to_i)

ans = 0

def binary_search(array, target)
  left = 0
  right = array.count - 1
  while left <= right
    mid = (left + right) / 2
    if target == array[mid]
      return 1
    elsif target < array[mid]
      right = mid - 1
    else
      left = mid + 1
    end
  end
  return 0
end

T.each do |i|
  ans += binary_search(S, i)
end

puts ans

