#include<stdio.h>
#include<stdlib.h>



int B_search(int *data,int size,int x){
  int min=0,max=size-1,mid;
  while(min<=max){
    mid=(min+max)/2;
    if(data[mid]<x) min=mid+1;
    else if(x<data[mid]) max=mid-1;
    else return mid;
  }
  return -1;
}

int main(){
  int i,n,q,count=0,x;
  int *S;
  scanf("%d",&n);
  S=malloc(n*sizeof(int));
  for(i=0;i<n;i++) scanf("%d",&S[i]);
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&x);
    if(B_search(S,n,x)!=-1) count++;
  }
  printf("%d\n",count);
  return 0;
}
  