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
    for j in S do
        if i == j then
            count += 1
        end
    end
end
puts count