include <stdio.h>
  int main(){
  int i,j,n,key;
  int count=0;
  scanf("%d",&n);
  int S[n];
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }
  scanf("%d",&key);
  int T[key];
  for(i=0;i<key;i++){
    scanf("%d",&T[i]);
  }
    for(i=0;i<key;i++){
    for(j=0;j<n;j++){
      if(S[j]==T[i]){
        count++;
        break;
      }
    }
    }
  printf("%d\n",count);
  return 0;
}


