gets
_S = gets.split.map(&:to_i).sort
gets
_T = gets.split.map(&:to_i).sort

count = 0
i = 0
_T.each{|t|
  while i < _S.size && _S[i] < t do
    i += 1
  end
  while i < _S.size &&  _S[i] == t do
    i += 1
    count += 1
    break
  end
}
puts count