var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n")
var a=Arr[1].split(" ").map(Number);
var b=Arr[3].split(" ").map(Number);
var c=[];

a.forEach(function(v,i){
if(b.indexOf(v)!=-1 && c.indexOf(v)==-1)c.push(v);
});

console.log(c.length);
});