#include <stdio.h>

int Linear(int T[],int key); //Linear search

int c=0;
int n,q,S[10000],T[500];
int NIL=-1;
  int key;
int j;

main(){

  int i,k; 
 
  scanf("%d",&n); //inpput n integers of S

  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }
  
  scanf("%d",&q); //input q integers of T

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

  
  for(j=0;j<q;j++){    
    T[j]=key;
    c = Linear(&T[j],key); 
    //c is the number of the same value in S and T
    //key is the searching value from S
    if (k==1)	c++; //add c if the number inside S is as same as one key of T
  }
  

  printf("%d",c);  // ouput of C
  printf("\n");
  
  return 0;
}

int Linear(int T[j],int k){ //search the same value"key" in T
  
  int i;
  
  for(i=0;i<n;i++){ //S loop
    if(S[i]==k)	{
      return 1; //the number of the same value in S and T
    }
    else 
      return 0;  
  }
}