#include<stdio.h>

int main(){
  int i,n,m,a[10001],q,sum=0,left,right,mid;

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

  scanf("%d",&m);
  for(i=0;i<m;i++){
    scanf("%d",&q);
    left=0;
    right=n;
    while(left<right){
      mid=(left+right)/2;
      if(mid==q){
        sum++;
        break;
      }
      else if(q<a[mid]) right=mid;
      else left=mid+1;
    }
  }
  printf("%d\n",sum);
  return 0;
}
