#include<stdio.h>

int main(){

  int s[10000],t[500],i,j,s_num,t_num,count;

  //??\???
  scanf("%d",&s_num);
  for(i = 0; i < s_num; i++){ 
    scanf("%d",&s[i]);
  }
  scanf("%d",&t_num);
  for(i = 0; i < t_num; i++){ 
    scanf("%d",&t[i]);
  }

  //search
  for(i = 0; i < s_num; i++){
    for(j = 0; j < t_num; j++){
      if(s[i] == t[j]){
	count++;
      }
    }
  }

  //??????
  printf("%d\n",count);

  return 0;
}