#include<stdio.h>
#define MAX 100000
#define NOT_FOUND -1

int binary(int *A, int key, int n){
  int left = 0;
  int right = n;
  int mid;
  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, n_S, n_T, cnt=0, find;
  int S[MAX], T[MAX];

  scanf("%d", &n_S);
  for(i=0; i<n_S; i++){
    scanf("%d", &S[i]);
  }
  scanf("%d", &n_T);
  for(i=0; i<n_T; i++){
    scanf("%d", &T[i]);
  }
  
  for(i=0; i<n_T; i++){
    if(binary(S, T[i], n_S-1) != NOT_FOUND){
      //printf("find!_____%d\n", binary(S, T[i], n_S-1));
      cnt++;
    }
  }
  

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

