no = gets.to_i
s = gets.split
no2 = gets.to_i
t = gets.split
t << ""
same=0

for j in 0..no
    i=0
    t[no2] = s[j]
    until t[i] == s[j]
        i+=1
    end
    unless i == no2
        same+=1
    end
end
p same