#include <stdio.h>
#define NOT_FOUND -111
int line (int ,int *,int );

int main(){
  
  int i,a[10000],b[500],n,q,c=0;
  
  scanf("%d",&n);
  for(i=0;i<n;i++)
    scanf("%d",&a[i]);
  
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&b[i]);
    if( line(n,a,b[i])!=NOT_FOUND)
      c++;
      
  }
  printf("%d\n",c);

  return 0;
} 
  line(int n,int a[],int key){
    int i = 0;
  a[n] = key;
  while (a[i]!= key) 
    i++;
  if (i ==n )
    return NOT_FOUND;
  return i;
  }

