n = gets(chomp:true).to_i
s = gets.split.map(&:to_i)
gets
t = gets.split.map(&:to_i)
count = 0

t.each do |t|

  left = 0
  right = n

  while left < right do

    mid = (left+right)/2

    if s[mid] == t
      count += 1
      break
    elsif s[mid] > t
      right = mid
    elsif s[mid] < t
      left = mid+1
    end

  end

end

puts count
