n = gets.to_i
S = gets.split.map(&:to_i)
q = gets.to_i
T = gets.split.map(&:to_i)
count = 0
for t in T
  start = -1
  last = n-1
  while !(last-start==1)
    mid = (start+last)/2
    if t > S[mid]
      start = mid
    else
      last = mid
    end
    if S[last] == t
      count += 1
      break
    end
  end
end
puts count