#include <stdio.h>
int search(int S[], int n, int key){
  S[n]=key;
  int i, j;
  i=0;
  while(S[i]!=key){
	++i;
}
  return i!=n;
}
int main(){
  int n, q;
  scanf("%d", &n);
  int S[10005], T[505];
  int i, j;
  int key;
  int count=0;
  for(i=0; i<n; ++i){
	scanf("%d", &S[i]);
}
  scanf("%d", &q);
  for(i=0; i<q; ++i){
	scanf("%d",&key);
	if(search(S, n, key)==1)
	  ++count;
}
  printf("%d\n", count);
  return 0;
}

