#include <stdio.h>
 
int main(){
  int i, j, n, k,count=0;
int S[100000],T[50000];
int left,right,mid;
  scanf("%d", &n);
  for(i=0;i<n;i++){
    scanf("%d", &S[i]);
  }
  scanf("%d", &k);
  for(i=0;i<k;i++){
    scanf("%d", &T[i]);
  }
  for(i=0;i<k;i++){
    left=0;
    right=n;
    while(left<right){ 
      mid=(left+right)/2;
      if(S[middle]==T[i]){
    count++;
    break;
      }
      else if(S[mid]<T[i]){
    left=mid+1;
      }
      else if(T[i]<=S[mid]){
    right=mid;
      }
      else break;
    }
  }
   
  printf("%d\n", count);
 
  return 0;
}