#include <stdio.h>

int main(){
  int N[10000]; int Q[500];
  int nnum, qnum;
  int left, right,mid, search;
  int i, count = 0;

  scanf("%d", &nnum);
  for(i = 0; i < nnum; i++){
  scanf("%d", &N[i]);
  }
  scanf("%d", &qnum);
  for(i = 0; i < qnum; i++){
  scanf("%d", &Q[i]);
  }

  for(i = 0;i < qnum; i++){
    search = Q[i];
    left = 0;
    right = nnum-1;
    
    while(left < right){
      mid = (left + right)/2;
      if(search == N[mid]){
	count++;
	break;
      }
      if(search > N[mid]){
	left = mid+1;
      }
      else if(search < N[mid]){
	right = mid;
      }
    }
  }

  printf("%d\n", count);
  return 0;
}

