#include <stdio.h>
#include <stdlib.h>

int main() {
  int numberN1,size1,numberN2,size2,i,j,count;
  int* sequenceArray1;
  int* sequenceArray2;

  scanf("%d", &numberN1);
  sequenceArray1 = malloc(sizeof(int) * numberN1);
  for(i=0; i<numberN1; i++) {
    scanf("%d", sequenceArray1+i );
  }

  scanf("%d", &numberN2);
  sequenceArray2 = malloc(sizeof(int) * numberN2);
  for(i=0; i<numberN2; i++) {
    scanf("%d", sequenceArray2+i );
  }

  for(i=0; i<numberN1; i++) {
    for(j=0; j<numberN2; j++) {
      if( *(sequenceArray1+i) == *(sequenceArray2+j) ) {
        count++;
      }
    }
  }
  printf("%d\n", count);

  return 0;
}