#include <stdio.h>

int Binary(int data[],int a, int b){
      int mid, left, right;
      left = 0;
      right = a;     
    while ( left < right ){  
        mid = ( left + right ) / 2;
        if ( data[mid] == b ) return 1;
        else if ( b < data[mid] ) right = mid;
        else left = mid + 1;
    }
    return 0;
    }  
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++){
    answer = answer + Binary(a, n, b[i]);
    }
    
  printf("%d", &answer);
  return 0;
}