#include <stdio.h>
#define NOT_FOUND -1

int i, j, n, S[100000000], q, T[100000000], N, key, num;
int binarySearch();
int main()
{
  int counter = 0;
  
  scanf("%d", &n); // S???????´???°
  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 < n; i++)
    {
      num = 0;
      for(j = 0; j < i; j++)
	if(T[j] == T[i]) num++;
      if(num == 0)
	{
	  key = T[i];
	  if(binarySearch() != NOT_FOUND) counter++;
	}
    }
  printf("%d\n", counter);
  
  return 0;
}

int binarySearch()
{
  int left = 0, right = n, mid;

  while(left < right)
    {
      mid = (left + right) / 2;
      if(S[mid] == key) return mid;
      else if(key < S[mid]) right = mid;
      else left = mid + 1;
    }
  return NOT_FOUND;
}
  