#include<stdio.h>

int binarySearch(int A[], int n, int key){
  int left = 0, middle, right = n;
  
  while(left < right){
    middle = (left + right) / 2;
    if(key == A[middle])
      return middle;
    if(key > A[middle])        left = middle + 1;
    else if(key < A[middle])   right = middle;
  }
  return 0;
}

int main(){
  int n, S[10000], q, T[10000], i, cnt = 0;

  scanf("%d", &n);
  for(i = 0; i < n; i++)
    scanf("%d", &S[i]);

  scanf("%d", &q);
  for(i = 0; i < q; i++)
    scanf("%d", &T[i]);

  for(i = 0; i < q; i++){
    if(S[binarySearch(S, n, T[i])] == T[i])   cnt++;
  }

  printf("%d\n", cnt);

  return 0;
}