#include <stdio.h>
#define NOT_FOUND 404

int i, n, S[1000], q, T[1000], N, key;
int linearSearch();
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++)
    {
      key = S[i];
      if(linearSearch() != NOT_FOUND) counter++;;
    }
  printf("%d\n", counter);
  
  return 0;
}

int linearSearch()
{
  int j = 0;
  T[n] = key;
  while(T[j] != key)
    {
      j++;
    }
  if(j == n) return NOT_FOUND;
  return j;
}