#include<stdio.h>

#define MAX 10000

int k,l;
int s[MAX],t[MAX];

int linearSearch(){
  int i,j,count;

  i = 0;
  count = 0;
  
  while( i < k ){
    j = 0;
    while( j < l){
      if(s[i] == t[j])
	count++;
      j++;
    }
    i++;
  }
  
  return count;
}

int main(){
  int i;

  scanf("%d",&k);
  for(i = 0; i < k; i++)
    scanf("%d",&s[i]);
  
  scanf("%d",&l);
  for(i = 0; i < l; i++)
    scanf("%d",&t[i]);

  printf("%d\n",linearSearch());
  
  return 0;
}

