n = gets.to_i
sArr = gets.chomp.split(' ').map(&:to_i)
q = gets.to_i
tArr = gets.chomp.split(' ').map(&:to_i)

ans = 0
tArr.each do |t|
    arr = sArr.dup
    while true do
        a = arr[arr.size / 2]
        if t == a then
            ans += 1
            break
        elsif t > a then
            if arr.size == 1 then
                break
            else
                arr = arr[arr.size / 2, arr.size]
            end
        else
            if arr.size == 1 then
                break
            else
                arr = arr[0, arr.size / 2]
            end
        end
    end
end

puts ans
