n = gets.to_i
S = gets.split(" ").map(&:to_i)
q = gets.to_i
T = gets.split(" ").map(&:to_i)
@count = 0

def binary_search(arr,n, target)
  left = 0
  right = n
  while(left < right)
    md = (left + right) / 2
    if(arr[md] == target)
      @count += 1
      return
    elsif arr[md] < target
      left = md + 1
    else
      right = md
    end
  end
end

T.each do |target|
  binary_search(S.dup, n, target)
end

puts @count

