#include <stdio.h>
 
int main(){
  int n,q;
  int S[100000],T[50000];
  int count=0;
  int mid, left, right,i,j;
 
  scanf("%d", &n );
  for (i=0 ; i<n; i++ ) 
    scanf("%d", &S[i] );
 
  scanf("%d", &q );
  for (j=0 ; j<q; j++ )
    scanf("%d", &T[j] );
 
  for(j=0; j<q; i++){
    left=0; 
    right=n;
    while(left<right){
      mid = (left + right)/2;
      if(S[mid]==T[j]){
        count++;
        break;
      }else if(S[mid]>T[j])right = mid;
       else 
       left = mid+1;
    }
  }
  printf("%d\n", count );
  return 0;
}