#include <stdio.h>
#define n 10000
#define q 5000

int main(){
  
int S[n];
int T[q];

int sNum,tNum;

int i,j;

int c = 0;

scanf("%d",&sNum);

for(i = 0; i < sNum; i++){
scanf("%d",&S[i]);
}

scanf("%d",&tNum);

for(i = 0; i < tNum; i++){
scanf("%d",&T[i]);
}

for(i = 0; i < sNum; i++){
for(j = 0; j < tNum; j++){
if(S[i] == T[j]) c++;
}
}

printf("%d\n",c);

return 0;
}