#include<stdio.h>

int main(){

  int n,m,x;
  int i,j,cnt=0,flag;
  int left,mid,right;
  
  scanf("%d",&n);

  int S[n];

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

  scanf("%d",&m);

  int T[m];

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

  for(i=0;i<n-1;i++){
    flag=1;
    while(flag){
      flag=0;
      for(j=n;j>=i;j--){
	if(S[j]<S[j-1]){
	  x = S[j];
	  S[j] = S[j-1];
	  S[j-1] = x;
	  flag = 1;
	}
      }
    }
  }

  
  for(i=0;i<m;i++){
    left = 0;
    mid = n/2;
    right = n;

    for(j=0;j<n;j++){
      if(T[i]==S[mid]){
	cnt++;
	break;
      }else if(T[i]>S[mid]){
	left = mid + 1;
	mid = (left + right) / 2;
      }else{
	right = mid;
	mid = (left = right) / 2;
      }
    }
  }

  printf("%d\n",cnt);
  
  return 0;
}

