#include <stdio.h>
void Search(int,int );
int S[10000],T[10000];

void Search(int n,int q){
int left,right,mid,N=0;
while(left <= right){
    mid = (left + right) / 2;
    if(S[mid] == T[q]){
      N++;  
     return N;

    }
    else if(S[mid] < T[q]){
      left = mid + 1; 
    }
    else{
      right = mid - 1;
    }
  }

}
int main(){
int n,q,i,j;

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

scanf("%d",&q);
for(j=0;j<n;j++)
	scanf("%s",T[j]);
	
Search(n,q);
return 0;
}