def is_include?(i, arr)
    if arr.length == 1 then
        if arr[0] == i then
            return true
        else
            return false
        end
    else
        x = arr.length / 2
        if i < arr[x] then
            is_include?(i, arr[0..x-1])
        else
            is_include?(i, arr[x..arr.length-1])
        end
    end
end

gets
s = gets.split.map(&:to_i)
gets
t = gets.split.map(&:to_i)
cnt = 0

x = s.length / 2
a = s[0..x-1]
b = s[x..s.length-1]

for i in t
    cnt += 1 if is_include?(i, s)
end

puts cnt
