#include <stdio.h>

int main(void)
{
   int n, S[1000000], q, T[1000000], i;
   int wa = 0;
   int left = 0;
   int rihgt = n;
   int mid;

   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[ i ]);
   }

   for ( i = 0; i < q; i++ ) {
      mid = ( left + right )/2;
      if ( T[ i ] == mid ) {
         wa = wa + 1;
      }
      if ( T[ i ] < mid ) {
         for ( j = 0; j < mid; j++ ) { 
            if ( S[ j ] == T[ i ] ) wa = wa + 1;
         }
      }
      if ( T[ i ] > mid ) {
         for ( j = mid + 1; j < n; j++ ) {
            if ( S[ j ] == T[ i ] ) wa = wa + 1;
         }
      }
   }
      
   printf("%d\n", wa);

   return 0;
}