#include<stdio.h>

int main(){
  int s_num,t_num,i,j,count=0,key;
  int s[10000],t[500];

  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]);
  }

  for(i = 0; i < t_num; i++){
    key = t[i];
    for(j = 0;j < s_num; j++){
      if(s[j] == key){
	count++;
      }
    }
  }
  printf("%d\n",count);
  return 0;
}