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

def linear_search(numbers, length, sentinel)
  i = 0
  numbers << sentinel
  while numbers[i] != sentinel
    i += 1
  end
  return i != length
end

sum = 0
t.each do |num|
  sum += 1 if linear_search(s, s.length, num)
end

puts sum