#include <stdio.h>

#define SMAX 100000
#define TMAX 50000

int main(){

  int i, j, temp, count, snum, tnum, left, right, mid;
  
  int sdata[SMAX];
  int tdata[TMAX];

  count = 0;

  scanf("%d", &snum);

  for(i = 0; i < snum; i++){

    scanf("%d", &sdata[i]);

  }

  
  scanf("%d", &tnum);

  for(i = 0; i < tnum; i++){

    scanf("%d", &tdata[i]);

  }

  for(i = 0; i < snum - 1; i++){

    for(j = snum - 1; j > i; j--){

      if(sdata[j] < sdata[j - 1]){
	
	temp = sdata[j - 1];

	sdata[j - 1] =  sdata[j];

	sdata[j] = temp;
	
      }
	
    }
     
  }
  


  for(i = 0; i < tnum; i++){

    left = 0;
    
    right = snum - 1;

    while(left < right){

      mid = ((left + right) / 2);

      if(tdata[i] == sdata[mid]){

	count++;
	//printf("%d\n", tdata[i]);
	break;

      }

      else if(tdata[i] > sdata[mid])
	left = mid + 1;

      else
	right = mid;

    }

  }
  
  printf("%d\n", count);

  return 0;

}