#include <stdio.h>
int main(void) {
  int i,j,n,answer=0;
  scanf("%d",&n);
  int S[n];
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
    }
  int q;
  scanf("%d",&q);
  int T[q];
  for(i=0;i<q;i++){
    scanf("%d",&T[i]);
    }
    
  for(i=0;i<q;i++){
    for(j=0;j<n;j++){
      if(T[i] == S[j]){
        answer = answer + 1;
        break;
        }
        }
        }
        printf("%d\n",&answer);
  return 0;
}