#include<stdio.h>
#define N 10000
int LinearSearch(int *,int,int);

 int main(){
  int i,j,k,l,count=0,a[N],b,c[N],d;
  scanf("%d",&b);
  for(i=0;i<b;i++){
    scanf("%d",&a[i]);
  }

  scanf("%d",&d);
  for(j=0;j<d;j++){
    scanf("%d",&c[j]);
  }

  for(i=0;i<d-1;i++){
  k =  LinearSearch(a,c[i],b);
  if(k<b) count++;
  }
  printf("%d\n",count);

  return 0;
 }

int LinearSearch(int *A,int key,int n){
  int i;
  i=0;
  A[n] = key;
  while(A[i]!=key){
    i++;
    if(i==n) return n;
    else return i;
  }
}