#include <stdio.h>

int main (){

     int a, b, c, m, n, o, S[10000], q, T[10000];
     scanf ("%d", &n);
     for ( m = 0; m < n; m++){
          scanf ("%d\n", &S[n]);
     }
     scanf ("%d", &q);
     for ( m = 0; m < q; m++){
          scanf ("%d\n", &T[q]);
          for ( o = 0; o < m + 1; o++){
               if ( T[o] == T[m]){
                    m = m - 1;
               }
          }
     }

     for ( a = 0; a < n; a++){
          for ( b = 0; b < q; b++){
               if (S[a] == T[b]){
                    c++;
               }
          }
     }

     printf ("%d", c);

     return 0;

}