#include<stdio.h>

int main(){

int n,q;
  int i,j;
  int s[100000],t[100000],c=0;
  int left=0,mid,right;
  scanf("%d",&n);

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

  right=n;
  scanf("%d",&q);

for(j=0; j < q; j++){
    scanf("%d",&t[q]);
    while(left < right){
    mid=(left+right)/2;
    if(t[q]==s[mid]) c++;
    else if(t[q] > s[mid]){
      left=mid+1;
    }
    else if(t[q] < s[mid]){
      right=mid;
    }
    }
 }

 printf("%d",c);

 return 0;
}