#include <stdio.h>

int main() {
  int firstline,secondline,rcount,rcount2,scount = 0;
  scanf("%d",&firstline);
  int firstarray[firstline];
  for (rcount = 0; rcount < firstline; rcount++) {
    scanf("%d ",&firstarray[rcount]);  
  }
  scanf("%d",&secondline);
  int secondarray[secondline];
  for (rcount = 0; rcount < secondline; rcount++) {
    scanf("%d ",&secondarray[rcount]);
  }

  for (rcount = 0; rcount2 < secondline; rcount2++) {
    for (rcount2 = 0; rcount < firstline; rcount++) {
      if (firstarray[rcount] == secondarray[rcount2]) {
	scount = scount + 1;
	break;
      }
    }
  }
  printf("%d",scount);
  return 0;
}