
#include <stdio.h>
int function(int,int);
#define N 1000000
#define Z 50000
int supecialarr[N];
int l=0;
int main(){
  int a,b,i,j,k,fun;
  int array1[N],array2[Z],array;
  int count = 0,arrcount = 0;

  scanf("%d\n",&a);
  for(i = 0 ; i < a; i++){
    scanf("%d",&array1[i]);
  }  

  scanf("%d\n",&b);

  for(j = 0 ; j < b ; j++){
    scanf("%d",&array2[j]);
  }

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

    for(j = 0 ; j < b ; j++){
      fun = function(array1[i],array2[j]);
      
if(fun == 1)count++;

    }
  }

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


int function(int arr1/*=>4*/,int arr2/*=>5*/){
  int i,count = 0;
  if(arr1 == arr2){
    supecialarr[l+1] = arr1;
  
    for(i = 0;i <= l;i++){
  
      if(supecialarr[l+1] ==  arr1) count++;
      if(count == 1) return 1;
    }

  }

  else return 0;

}