#include<stdio.h>
#define N 100000
#define Q 50000

int main(){
  int n,q,mid,s[N],t[Q],i,j,key[N],left,right,judge=0,count=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]); 

  left = 0;
  right = n;
  for(i=0;i<q;i++){
    judge=0;
    for(j=0;j<count;j++){
      if(key[j]==t[i]) judge=1;
    }
    if(judge==0){
      key[count]=t[i];
      while(left<right){
	mid = (left + right) / 2;
	if (s[mid] == key[count]){
	  count++;
	  break;
	}
	if(key[count]<s[mid]) right = mid;
	else left = mid + 1;
      }
    }
  }
  

  printf("%d\n",count+1);

  return 0;
}

