#include <stdio.h>

int main(void) {
  int i,n,answer=0;
  scanf("%d",&n);
  int a[n];
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
    }
  int q;
  scanf("%d",&q);
  int b[q];
  for(i=0;i<q;i++){
    scanf("%d",&b[i]);
    }
    
  for(i=0;i<q;i++){
      int mid, left, right;
      left = 0;
      right = n;     
    while ( left < right ){  
        mid = ( left + right ) / 2;
        if ( a[mid] == b[i] ){
         answer = answer +1;
         }
        else if ( b[i] < a[mid] ){
         right = mid - 1;
         }
        else{
         left = mid + 1;
         }
    }
    }    
  printf("%d", &answer);
  return 0;
}