
S_SEQUENCE = gets.chomp.to_i
S_ARRAY = gets.chomp.split(" ").map(&:to_i).sort
T_SEQUENCE = gets.chomp.to_i
T_ARRAY = gets.chomp.split(" ").map(&:to_i).sort

ans = 0

T_ARRAY.each do |val|
  left = 0
  right = S_ARRAY.count
  while left < right do
    mid = (left + right) / 2
    if S_ARRAY[mid] == val
      ans += 1
      break
    elsif val < S_ARRAY[mid]
      right = mid
    else # val < S_ARRAY[mid]
      left = mid + 1
    end
  end
end

p ans