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;
var len=a.length;
var ab=0;
for(var i=0;i<b.length;i++){
   if(i!=0 && ab==b[i])continue;
   if(binarySearch(b[i]))cnt++;
   ab=b[i];
}
 console.log(cnt);

function binarySearch(key){
    var left = 0;
    var right = len;
    while( left < right){
        var mid =Math.floor((left + right)/2);
        if (a[mid] == key) {return true;}
        else if (key < a[mid]) {right = mid;}
        else {left = mid + 1;}
    }
    return false;
}