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 cnt=0;
a.forEach(function(v,i){
if(b.indexOf(v)!=-1)cnt++;
});
console.log(cnt);