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

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