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

count = 0
for i in T do
    left = 0
    right = S.count - 1
    while left < right do
        middle = (left + right) / 2
        if S[middle] < i then
            left = middle
        elsif S[middle] > i then
            right = middle
        else
            count += 1
            break
        end
    end
end
puts count