#include<stdio.h>

int S[100000], N;

int binarySearch(int X){
  int left = 0;
  int right = N;
  int middle;
  
  while(left < right){
    middle = (left + right) / 2;
    if(X == S[middle]){
      return 1;
    }
    else if(X > S[middle]){
      left = middle + 1;
    }
    else {
      right = middle;
    }
  }
  return 0;
}

int main(){
  int N, M, i, j, X, k = 0;
  
  scanf("%d", &N);
  for(i = 0; i < N; i++){
    scanf("%d", &S[i]);
  }
  
  
  scanf("%d", &M);
  for(j = 0; j < M; j++){
      scanf("%d", &X);
      if(binarySearch(X) == 1){
        k = k + 1;
      }
  }
  
  printf("%d\n",k);
  
  return 0;
}