
#include <stdio.h>

main(){
  int i, r, l, m, rs, rt, S[100000], T[50000],f,t,k,c = 0;

  scanf("%d", &rs);
  for(i = 0;i < rs;i++) scanf("%d", &S[i]);

  scanf("%d", &rt);
  for(i = 0;i < rt;i++) scanf("%d", &T[i]);

  for(i = 0;i < rs;i++){
    t = rt;
    k = 0;
    f = 1;
    while(1){
      r = t + 1;
      l = k;
      m = (r + l) / 2;
      if(S[i] < T[m]) t = m - 1;
      else if(S[i] > T[m]) k = m + 1;
      else if(S[i] == T[m]){
	  c++;
	  break;
	}
      else break;
    }
  }
  printf("%d\n", c);
  return 0;
}