def binarySearch(key, array)
  left = 0
  right = array.size
  while left < right do
    mid = (left+right)/2
    if array[mid] == key
      return mid
    elsif array[mid] < key
      left = mid + 1
    else
      right = mid
    end
  end
  return -1
end

gets
s = gets.split.map(&:to_i)
gets
t = gets.split.map(&:to_i)
count = 0
t.each do |num|
  if binarySearch(num, s) != -1
    count += 1
  end
end
puts count
