#include <stdio.h>

#define MAX_N 100000

int main(){
  int N,Q,i,S[MAX_N],T,l,mid,r,res = 0;
  scanf("%d",&N);
  for(i = 0 ; i < N ; i++){
    scanf("%d",&S[i]);
  }
  scanf("%d",&Q);
  for(i = 0 ; i < Q ; i++){
    scanf("%d",&T);
    l = -1, r = N;
    while(r - l > 0){
      mid = (l + r) / 2;
      if(S[mid] == T){
        ++res;
        break;
      }else if(S[mid] > T){
        r = mid;
      }else{
        l = mid+1;
      }
    }
  }
  printf("%d\n",res);
  return 0;
}