no = gets.to_i
s = gets.split
no2 = gets.to_i
t = gets.split
same=0
for j in 0...no2
    i=0
    s[no] = t[j]
    until s[i] == t[j]
        i+=1
    end
    unless i == no
        same+=1
    end
end
puts same