#include <stdio.h>

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