n = gets.to_i
S = gets.split(" ").map(&:to_i)
q = gets.to_i
T = gets.split(" ").map(&:to_i)

a = 0
for i in 0..q-1
left = 0
right = n
  while left < right
    mid = (left+right)/2
    if S[mid] == T[i]
      a += 1
    else if S[mid] < T[i]
      right = mid
    else
      left = mid +1
    end
  end
end
puts a