#include <stdio.h>
#define N 100000
#define Q 5000
main(){

  int s,t,c=0,i,j,m,r,l;
  int a[N],b[Q];
  scanf("%d",&s);
  for(i = 0; i < s; i++){
    scanf("%d",&a[i]);
  }
    scanf("%d",&t); 
   for(i = 0; i < t; i++){
      scanf("%d",&b[i]);
      r = s;
      l = 0;
      while(l <= r){
	m = (r + l) / 2;
	if(b[i] == a[m])
	  {
	    c++;
	    break;
	  }
	else if(b[i] > a[m]) l = m + 1;
	else r = m - 1;
      }
   }
printf("%d\n",c);
 return 0;
}