#include<stdio.h>

int main(){
  int i, j, n, q, c=0, left, right, mid;
  int S[100001], T[50001];

  scanf("%d",&n);
  for(i=1; i<=n; i++){
    scanf("%d",&S[i]);
  }
  scanf("%d",&q);
  for(i=1; i<=q; i++){
    scanf("%d",&T[i]);
  }
  for(j=1; j<=n; j++){
    for(i=1; i<=q; i++){
      if(S[j] == S[j+1]) continue;
      left = 0;
      right = n;
      mid = n/2;
      while(left < right){
	if(S[mid] == T[i]) c++;
	else if(S[mid] < T[i]) left = mid+1;
	else if(S[mid] > T[i]) right = mid;
      }
    }
  }
  printf("%d\n",c);
  return 0;
}