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

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

  //ARRAY_NUMBER
  int sNum,tNum;

  //ROOP_NUMBER
  int i,j,k;

  //ELEMENT_COUNETR
  int c = 0;

  //OVERLAP_JUDGE
  int flag;

  //BINARY_NUMBER
  int tail,head,mid;

  int key;

  //ARRAY_S_SCAN
  scanf("%d",&sNum);

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

  //ARRAY_T_SCAN
  scanf("%d",&tNum);

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


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

    flag = 0;
    tail = sNum;
    head = 0;

    while(tail >= head){

      printf("\ttail:%d head:%d c:%d\n",tail,head,c);

      mid = (head + tail) / 2;

      if(T[i] > S[mid]){
	head = mid + 1;

      }else if(T[i] < S[mid]){
	tail = mid;

      }
      else{
	if(T[i] == S[mid]){

	  for(k = 0; k < c; k++){
	    if(U[k] == T[i]){
	      flag = 1;
	      break;
	    }
	  }
	  if(flag == 0){
	    U[c] = T[i];
	    c++;
	  }

	}
	break;
      }
    }
  }

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

  return 0;
}