#include <stdio.h>
#define N 1000000
#define Q 50000
main(){
  int s[N], t[Q];
  int i, j, right, left, center, a, b, count = 0;
  scanf("%d", &a);
  for(i=0;i<a;i++)
    {
      scanf("%d", &s[i]);
    }
  scanf("%d", &b);
  for(j=0;j<b;j++)
    {
      scanf("%d", &t[j]);
    }

  for(i=0;i<a;i++)
   {
    right = b;
    left = 0;
    while(left <= right)
     {
      center = (left + right) / 2;
      if(t[i] == s[center])
       {
	count++;
        break;
       }
      else if(t[i] > s[center])
        left = center + 1;
      else if(t[i] < s[center])
        right = center - 1;
     }
   }
   printf("%d\n", count);
   return 0;
    }