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

int main(){
  int i,j,n,q,cnt=0;
  int m,right,left;
  int S[N],T[Q];
  
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }
  for(j=0;j<n;j++){
    scanf("%d",&T[j]);
  }
  for(i=0;i<q;i++){
    right=n;
    left=0;
    
    while(left<=right){
      m=(right+left)/2;
      if(S[m]==T[i]){
	cnt++;
	break;
      }
      else if(S[m]<T[i]){
	left=m+1;
      }
      else if(S[m]>T[i]){
	right=m-1;
      }
    }
  }
  
  printf("%d\n",cnt);
  return 0;
}