#include <stdio.h>

int calcu(int, int);

int C = 0;
int S[10000+1];

int main()
{
  int i, j, n, q;
  int key; 

  scanf("%d",&n);

  for( i = 0 ; i < n ; i++ ) scanf("%d", &S[i]);
  
  scanf("%d",&q);
  
  for( i = 0 ; i < q ; i++ ){
    scanf("%d", &key);
    C = calcu(key, n);
  }
  
  printf("%d\n", C);
  
  return 0;
}
 
int calcu(int k, int n)
{
  int i;

  for( i = 0 ; i < n ; i++ ){
      if( S[i] == k ) C++;
  }

  return C;
}