#include <stdio.h>
int main(){
  int n1,n2,i,j,count=0;
  int A[10001],B[10001];
  scanf("%d",&n1);
  for(i=0;i<n1;i++){
    scanf("%d",&A[i]);
  }
  scanf("%d",&n2);
  for(i=0;i<n2;i++){
    scanf("%d",&B[i]);
  }
  for(i=0;i<n2;i++){
    j=0;
    A[n1]=B[i];
    while(A[j]!=B[i]){
      j++;
    }
    if(j!=n1)count++;
  }
  printf("%d\n",count);
  return 0;
}