#include<stdio.h>
// left = 0
//   right = n
      // while left < right
      //    mid = (left + right) / 2
      //  if A[mid] == key
      //      return mid
      //  else if key < A[mid]
      //      right = mid
      //  else
	  //left = mid + 1
	      //    return NOT_FOUND
	      
int main(){
  int i, left, right, mid, n, count = 0;
  scanf("%d", &n);
  int A[n];
  for(i = 0 ; i < n ; n++){
    scanf("%d", &A[i]);
  }
  scanf("%d", &n);
  int B[n];
  for(i = 0 ; i < n ; n++){
    scanf("%d", &B[i]);
  }
  i = 0;
  for(i = 0 ; i < n ; i ++){
    int key = B[i];
    left  = 0;
    right = n;
    while(left < right){
      mid = (left + right) / 2;
      if(A[mid] == key){
	count++;
    }
      else if(key < A[mid]){
      right = mid;
      }
      else{
      left = mid + 1;
      }
    }
  }
  printf("%d\n", count);
}

