#include<stdio.h>
#define S_MAX 10000
#define T_MAX 10000

int main()
{
  int S[S_MAX], n, T[T_MAX], q, C=0, flag=0;
  int left, right, mid, key;
  int i, j;

  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++){
    key=T[i];
    left=0;
    right=n;

    while((left < right) && (flag == 0)){
      mid=(left+right)/2;

      if(S[mid] == key){
	flag=1;
      }

      else if(S[mid] > key){
	right = mid;
      }
      else
	left = mid+1;
    }
    
    if(flag == 1){
      C++;
    }
    flag=0;
  }

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

  return 0;
}