def binarysearch(arr,key)
    left = 0
    right = arr.count-1
    while left <= right
        mid = (left+right)/2
        if arr[mid] == key
            return mid
        elsif key < arr[mid]
            right = mid-1
        else
            left = mid +1
        end
    end
    return false
end

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

count = 0

T.each do |x|
    if binarysearch(S,x)
        count +=1
    end
end

puts count
