#include <stdio.h>
void Search(int,int);
int S[10000],T[10000];

void Search(int n,int q){
int left,right,mid,k;
while(left < right){
    mid = (left + right) / 2;
    if(S[mid] == k){
     return 1;
    }
    else if(k < S[mid]){
      right = mid ; 
    }
    else{
      left = mid + 1;
    }
  }
return 0;

}
int main(){
int n,q,i,j,count;

scanf("%d",&n);
for(i=0;i<n;i++)
	scanf("%d",&S[i]);

scanf("%d",&q);
for(j=0;j<n;j++)
scanf("%d",&T[j]);

 if( Search(n,q) )count++;

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

return 0;
}