#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;
    mid = tail / 2;

    while(T[i] != S[mid]){
      if(T[i] > S[mid]){
	head = mid + 1;
	mid = mid + ((tail - mid) / 2);

      }else if(T[i] < S[mid]){
	tail = mid - 1;
	mid = (mid - head) / 2;
      }
      if(tail == head) break;
    }
    c++;
    /*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++;
      }

      }*/		  
  }

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

  return 0;
}