#include<stdio.h>
#include<string.h>

int N,N2;

int main(){

  int i,j,c=0;

  scanf("%d",&N);

  int s[N];

  for(i=0;i<N;i++){
    scanf("%d",&s[i]);
  }

  scanf("%d",&N2);

  int s2[N2];

  for(i=0;i<N2;i++){
    scanf("%d",&s2[i]);
  }


  for(i=0;i<N;i++){
    for(j=0;j<N2;j++){
      if(s[j]==s2[i]){
        c++;
        break;
      }
      }
    }


  printf("%d\n",c);


  return 0;
}
