#include<stdio.h>

 int search(int n,int S[],int T){
          int i;
          S[n]=T;
          i=0;
          while(S[i] != T)i++;
          return i != n;
          }
       

 int main(){
          int i,n,T,q,S[10001],cnt=0,j;

          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);
                    if(search(n,S,T))cnt++;
                    }

          printf("%d\n",cnt);
          return 0;
          }
