#include <stdio.h>
 
#define N 10000
#define Q 500
 
int main()
{
  int i, j, count=0;
  int S[N], T[Q];
   
  scanf("%d", &S[0]);

  for(i=1; i<S[0]+1; i++)
    {
      if(S[i] <= 10*10*10*10*10*10*10*10*10)
	{
	  scanf("%d", &S[i]);
	}
    }

  scanf("%d", &T[0]);
  for(i=1; i<T[0]+1; i++)
    {
      if(T[i] <= 10*10*10*10*10*10*10*10*10)
	{
	  scanf("%d", &T[i]);
	}
    }
   
  for(i=1; i<S[0]+1; i++)
    {
      for(j=1; j<T[0]+1; j++)
    {
      if(S[i] == T[j])
        {
          count = count + 1;
        }
    }

    }
    printf("%d\n", count);

return 0;
  }