#include<stdio.h>

int main(){

  int hai[100000];
  int hai2[50000];
  int k,i,a,e,right,left,mid,j,key,v;
  int cnt = 0;
  


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

  scanf("%d",&a);

  for( e = 0; e < a; e++){
    scanf("%d",&hai2[e]);
  }

for(v = 0; v < a; v++){
  j = 0;
  key = hai2[v];
  hai[k] = key;
  left = 0;
  right = k;

  while(left < right){
    mid = (left + right)/2;
    if(hai[mid] == key){
      cnt++;
      break;
    }else if(key < hai[mid]){
      right = mid;
    }else{
      left = mid +1;
    }
  }
 }

 printf("%d\n",cnt); 
  
  return 0;
}

